|
The other way to do this without pointers would be: fTESTDS1 if e disk d OneRec ds Qualified d MyFec 3 d MyFecOk 1 d MapDS e ds ExtName(TESTDS) d Qualified d MyArray LikeDs(OneRec) d Dim(8) d Overlay(MapDS) d Count s 10u 0 Inz(0) /Free DoU 0 = 1; Read TestDS1; If %Eof(TestDS1); Leave; EndIf; Count += 1; MapDS.MyArray(Count).MyFec = XXFec; MapDS.MyArray(Count).MyFecOk = '?'; EndDo; *InLR = *On; Return; /End-Free Demonstrates nice use of nested arrays and mapping fields to data structures. I love qualified data structures. I compiled and test code. -----Original Message----- From: Lim Hock-Chai [mailto:Lim.Hock-Chai@xxxxxxxx] Sent: Wednesday, November 17, 2004 4:08 PM To: RPG programming on the AS400 / iSeries Subject: Array over fields in a data structure If I have a PF (use it as data structure only) that contains the following like below: A R TESTDSFMT A MYFEC1 3 A MYFEC1OK 1 A MYFEC2 3 A MYFEC2OK 1 A MYFEC3 3 A MYFEC3OK 1 A MYFEC4 3 A MYFEC4OK 1 A MYFEC5 3 A MYFEC5OK 1 A MYFEC6 3 A MYFEC6OK 1 A MYFEC7 3 A MYFEC7OK 1 A MYFEC8 3 A MYFEC8OK 1 And I've a INPUT file that contain a field XXFEC A R INPUTFMT A XXCUST 9 A XXFEC 3 A K XXCUST If the program needs to loop thru this input file for a XXCUST to load XXFEC to fields MYFEC1 to MYFEC8, what would be the easiest way to do this? I'm going blank here. thanks
As an Amazon Associate we earn from qualifying purchases.
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.