Why not read the file directly into the data structure like Kurt suggested
earlier. I would just make a few minor changes, to fit my flavor of
programming:
Kurt's Code:
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;
My code, well it is Kurt's with minor changes (untested):
FFile1 IF E K Disk
FFile2 UF A E K Disk Rename( FileRec: FileRec2 )
D dsFile1 E DS ExtName(File1) Qualified
D dsFile2 E DS ExtName(File2:*Output) Qualified
/free
DoU %eof( File1 );
Read File1 dsFile1;
If not %eof( File1 );
Chain dsFile1.key File2;
If %found( File2 );
dsFile2 = dsFile1;
Update FileRec2 dsFile2;
Else;
Write FileRec2 dsFile2;
EndIf;
EndIf;
EndDo;
Jeff Davis
Programmer
Dental Network of America
2 Transam Plaza Drive, Suite 500
Oakbrook Terrace, IL. 60181
630.691.0336
"Gundermann, Glenn / Kuehne + Nagel / Tor ZI-A"
<Glenn.Gundermann@xxxxxxxxxxxxxxxx>
Sent by: rpg400-l-bounces@xxxxxxxxxxxx
11/11/2009 03:23 PM
Please respond to
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
To
RPG programming on the IBM i / System i <rpg400-l@xxxxxxxxxxxx>
cc
Subject
RE: Reading directly into a DS
Hi Stuart,
Thank you for taking a look.
The technique I am trying to use requires the period because the data
structure subfields will all be I.fieldname due to the Qualified keyword
on the data structure.
Tks, Glenn
To learn more about Kuehne + Nagel Ltd, please visit our website at:
www.kuehne-nagel.com For the Kuehne + Nagel email disclaimer, visit:
http://www.kn-portal.com/material/Electronic_Email_Disclaimer_English_French.pdf
Visitez le site internet de Kuehne + Nagel Lt?e: www.kuehne-nagel.com
Notre d?charge de responsabilit? est disponible comme suit:
http://www.kn-portal.com/material/Electronic_Email_Disclaimer_English_French.pdf
As an Amazon Associate we earn from qualifying purchases.