Re: Save for then restore all DSPF record format fields

Daniel Gross <[email protected]>
Newsgroups gmane.comp.lang.as400.rpg
Message-ID <[email protected]>
Hi Gio,

Am 13.08.2025 um 12:36 schrieb gio.cot via RPG400-L <[email protected]>:

> In a program that manage DSPF, i would need  to save all the record format fields before the EXFMT and then if the user press F3, i need to restore all the record format fields to their values before the EXFMT ..
> 
> Which could be an easy way to do that ?


My idea would be to define one unqualified data structure from the record format - and one qualified. 

dcl-ds rcdfmtDS extname(...:*all) end-ds;
dcl-ds saveDS extname(...:*all) qualified end-ds;

Then save the record format before the EXFMT - and restore it afterwards if F3 was pressed:

   eval-corr saveDS = rcdfmtDS;
   exfmt ...;
   if ...; // F3 condition
     eval-corr rcdfmtDS = saveDS;
   end-if; 

This should work IMHO. 

As the record format fields are "automatically synced" with the fields of the unqualified data structure, the data there is always the same as the record formats data - thank you RPG. 

On the other side the saveDS is qualified - completely separated in memory - but easily transferable with EVAL-CORR. 

HTH 
Daniel
-- 
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.