× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Jeff,

I think you'd want to pull the "dsFile2 = dsFile1;" line out of the %found logic b/c I don't see how you're loading it for the Write.

Just for my own benefit, why do you like ExtName better than LikeRec? I noticed you had to specify Qualified when LikeRec implicitly specifies it.

Thanks,
Kurt

-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of jdavis@xxxxxxxx
Sent: Wednesday, November 11, 2009 3:39 PM
To: RPG programming on the IBM i / System i
Cc: RPG programming on the IBM i / System i; rpg400-l-bounces@xxxxxxxxxxxx
Subject: RE: Reading directly into a DS

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.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.