Re: Save for then restore all DSPF record format fields
Patrik Schindler <[email protected]>
| Newsgroups | gmane.comp.lang.as400.rpg |
|---|---|
| Message-ID | <[email protected]> |
Hello 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 ? I have a similar issue solved with load-paged SFLs. Code can be found here: https://github.com/PoC-dev/as400-sfltemplates/blob/main/v_lodpagpg.rpgle In short, I define a DS with the PFs field names in line 109, and clone that in line 112, fields being prepended by C_ (for copy) in line 112. You can do the same with a display file's recfmt. Newer versions of RPG allow you to use LIKEDS, QUALIFIED, etc. for easier code maintenance, and confinement of variables. Later, starting Line 327, I clear and copy (MOVEL) the DS data in one go, so I don't lose the data when locking the record by a CHAIN, and copy the saved data back in line 338. I honestly can't recall why I used MOVEL and then EVAL instead of doing it in a consistent manner. Does that help? Note: I'm a hobbyist deliberately doing things on a stone age model 150 running V4R5. :wq! PoC -- 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.