RE: How to save an entire record in a Data Structure in Free ILE RPG

<dfreinkel-cbKQUZO/W6aaLr2CDSiKrwC/[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
We need more information than these few lines. I see you read the records.

Do you have an update or delete in your program?

Darryl Freinkel
A4G
Telephone: 770.321.8562 

-----Original Message-----
From: RPG400-L <rpg400-l-bounces-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org> On Behalf Of Mohan
Eashver
Sent: Friday, February 6, 2026 1:12 PM
To: RPG programming on IBM i <[email protected]>
Subject: How to save an entire record in a Data Structure in Free ILE RPG

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: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives at
https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org 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: RPG400-L-request-+hD5IHI5Xscn3HwCXmMcX9BPR1lH4CV8@public.gmane.org
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support-FMtJrHiV//lnDLsaKlm4mFaTQe2KTcn/@public.gmane.org for any subscription related questions.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.