|
You MUST not use the E (external) file type if you intend to use IO with
structures, IIRC. You have to use "F" and state the record length. The
structure size must then match this record length exactly.
Usually I do this with qualified data structures. You'll probably want to
(or use the prefix thing with a really short prefix). For the prefix you
know you can REMOVE letters from the beginning of the external field name?
LIke when your fields all start with MF (master file) you could PREFIX(
'I_':2) or PREFIX('O_':2) and replace that MF with either I_ or O_ (input,
output).
Stu
On Wed, Nov 11, 2009 at 08:53, Kurt Anderson <kurt.anderson@xxxxxxxxxxxxxx
wrote:
Hi Glenn,
Unless I missed it, I don't see where your code loads the I data
structure. Here's a quick (untested) sample of how I would do it.
FFile1 IF E K Disk
FFile2 UF A E K Disk Rename( FileRec: FileRec2 )
D dsFile1 DS LikeRec( FileRec )
D dsFile2 DS LikeRec( FileRec2: *output )
/free
DoU %eof( File1 );
Read File1 dsFile1;
If not %eof( File1 );
dsFile2 = dsFile1;
SetLL dsFile1.key File2;
If %equal( File2 );
Update FileRec2 dsFile2;
Else;
Write FileRec2 dsFile2;
EndIf;
EndIf;
EndDo;
- Kurt Anderson
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [[2]mailto:rpg400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Gundermann, Glenn / Kuehne + Nagel / Tor ZI-A
Sent: Wednesday, November 11, 2009 6:59 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: Reading directly into a DS
Hi folks,
I'm going in circles here and was hoping someone wouldn't mind helping me.
I'm trying to read data directly into a DS and then write the data to
another file, either with an update or a write, using the data structure.
I know there are different styles, like READ file-name ds-name, and I'm
not sure which is the preferred style.
First of all, we're on V5R4.
This program reads the records from an intermediate file and either
updates or adds them to the master file.
The intermediate file was created using CRTDUPOBJ of the master file,
which is why the record format is renamed.
The files each have 7 fields, of course with the same name.
1. I tried having a meaningful prefix on the F-spec but I received a
compile error RNF2356, I think because there is a limit of 13 to the field
name length.
What can I do to improve this?
2. I'm getting compile time errors:
*RNF7030 30 7 The name or indicator is not defined.
(I.field1, I.field2, etc. for the 7 fields in the file)
*RNF7701 20 2 The data structure is not allowed for the operation.
(Update ACCDOCR I and Write ACCDOCR I)
Any tips would be most appreciated.
Yours truly,
Glenn Gundermann
Work: (905) 501-6596
Cell: (416) 317-3144
glenn.gundermann@xxxxxxxxxxxxxxxx<mailto:
glenn.gundermann@xxxxxxxxxxxxxxxx>
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.