Re: How to save an entire record in a Data Structure in Free ILE RPG
Jon Paris <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
Daniel - you are correct that the use of Likerec will result in a qualified DS and to avoid that you can indeed use an externally described DS. But - there is no need for Eval-Corr you can simply name the DS as the target tor the READE. e.g. readE (...) fI3APPTP1 nameOfDS; Jon Paris [email protected] > On Feb 6, 2026, at 2:42 PM, Daniel Gross <[email protected]> wrote: > > Hi Mohan, > > as both of your external data structures and also the LIKEREC data structure are QUALIFIED (with LIKEREC the QUALIFIED is implicit IIRC) so you will have to move your data manually into those data structures. > > But one simple solution might be, to create your A_Row DD as an external DS without QUALIFIED - all member fields in this DS will then automatically be "filled" when the input buffer is filled. > > dcl-ds A_Row extname('I3APPTP1') end-ds; > > With this buffer DS you can simply do: > > readE (...) fI3APPTP1; > eval-corr I3A_First = A_Row; > > And it should work. You can also move the data structure directly - but I really recommend using EVAL-CORR to make sure all fields are moved correctly. > > HTH > Daniel > > >> Am 06.02.2026 um 19:51 schrieb Marco Facchinetti <[email protected]>: >> >> Try with: readE (...) fI3APPTP1 A_Row >> >> HTH; >> -- >> Marco Facchinetti >> >> Mr S.r.l. >> >> Tel. 035 962885 >> Cel. 393 9620498 >> >> Skype: facchinettimarco >> >> >>> Il giorno ven 6 feb 2026 alle ore 19:12 Mohan Eashver <[email protected]> >>> ha scritto: >>> >>> Happy Friday All, >>> >>> I have a file with multiple rows for a KEY field. >>> My task is to save the first & last rows for the Key-Combo & compare them >>> later. >>> >>> My RPG program does SETLL & READE to get the 1st row & SETGT & READPE to >>> get the last row. >>> >>> In this RPG-Free code, I3APPTP1 is the File name & fI3APPTP1 is the Record >>> Format name. >>> >>> After the program runs, there is nothing in A_Row, nothing in I3A_First & >>> nothing in I3A_Last. >>> >>> But through my debug session I can confirm that READE & READPE are >>> successfully completing the IO & I have seen the values when I lookup (eval >>> field1 etc) every column of the row. >>> >>> dcl-F I3APPTP1 Usage(*Input : *Update) Keyed USROPN; >>> >>> dcl-DS I3A_First ExtName('I3APPTP1') Qualified; >>> end-DS; >>> >>> dcl-DS I3A_Last ExtName('I3APPTP1') Qualified; >>> end-DS; >>> >>> dcl-DS A_Row LikeRec(fI3APPTP1 : *ALL); >>> >>> setLL (...) fI3APPTP1; >>> readE (...) fI3APPTP1; >>> I3A_First = A_Row; >>> >>> setGT (...) fI3APPTP1; >>> readPE (...) fI3APPTP1; >>> I3A_Last = A_Row; >>> >>> I am looking for a solution entirely using Free RPG hence not looking for a >>> SQL solution at this time. >>> >>> ---- >>> Regards, >>> Mohan Eashver >>> -- >>> This is the RPG programming on IBM i (RPG400-L) mailing list >>> To post a message email: [email protected] >>> To subscribe, unsubscribe, or change list options, >>> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l >>> or email: [email protected] >>> Before posting, please take a moment to review the archives >>> at https://archive.midrange.com/rpg400-l. >>> >>> Please contact [email protected] for any subscription related >>> questions. >>> >>> >> -- >> This is the RPG programming on IBM i (RPG400-L) mailing list >> To post a message email: [email protected] >> To subscribe, unsubscribe, or change list options, >> visit: https://lists.midrange.com/mailman/listinfo/rpg400-l >> or email: [email protected] >> Before posting, please take a moment to review the archives >> at https://archive.midrange.com/rpg400-l. >> >> Please contact [email protected] for any subscription related questions. >> > -- > This is the RPG programming on IBM i (RPG400-L) mailing list > To post a message email: [email protected] > To subscribe, unsubscribe, or change list options, > visit: https://lists.midrange.com/mailman/listinfo/rpg400-l > or email: [email protected] > Before posting, please take a moment to review the archives > at https://archive.midrange.com/rpg400-l. > > Please contact [email protected] for any subscription related questions. > -- This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: [email protected] To subscribe, unsubscribe, or change list options, visit: https://lists.midrange.com/mailman/listinfo/rpg400-l or email: [email protected] Before posting, please take a moment to review the archives at https://archive.midrange.com/rpg400-l. Please contact [email protected] for any subscription related questions.