|
Hi Scott, If I understand the requirement (wouldn't be the first time I haven't), you can do all of this in one DS - without pointers etc. In RPG IV, an interesting thing happens when you Overlay onto an array - you get an array. The following should do what you want. Note the definition of MarkerPath, Marker and Path - Marker and Path will be arrays, they do not require the DIM keyword. BTW, since you said the size of the data area is 1030, you should define the Marker fields as signed numeric - assuming that they occupy 3 bytes in the data area (in your example they would have efaulted tp packed). HTH Paul Tuohy D PdfLoc DS Qualified D Marker1 3S 0 D Path1 100 D Marker2 3S 0 D Path2 100 D Marker3 3S 0 D Path3 100 D Marker4 3S 0 D Path4 100 D Marker5 3S 0 D Path5 100 D Marker6 3S 0 D Path6 100 D Marker7 3S 0 D Path7 100 D Marker8 3S 0 D Path8 100 D Marker9 3S 0 D Path9 100 D Marker10 3S 0 D Path10 100 D MarkerPath 130 Dim(10) Overlay(PdfLoc) D Marker 3S 0 Overlay(MarkerPath) D Path 100 Overlay(Markerpath:*Next) D X S 5I 0 /Free For x = 1 to 10; PdfLoc.Marker(x) = x; EndFor; For x = 1 to 10; PdfLoc.Path(x) = '/' + %Char(PdfLoc.Marker(x)); EndFor; *InLR = *On; /End-Free ----- Original Message ----- From: <SCarter@xxxxxxxxxxx> To: "RPG programming on the AS400 / iSeries" <rpg400-l@xxxxxxxxxxxx> Sent: Friday, August 01, 2003 12:39 AM Subject: Qualified Data Area array > > I have a data area that is 1030 characters long with > the structure > marker1 3 0 > path1 100a > marker2 3 0 > path2 100a > marker3 3 0 > path3 100a > . > . > marker10 3 0 > path10 100a > > How do I create a ds to move the data area into an array so I can use code > like the following.... > /free > for x = 1 to 10; > if pdfloc.marker(x) = somevar; > path =pdfloc.path(x); > endif; > endfor; > /endfree > > this is how I think it would look but am unsure > d pathds ds based(@) qualified > d marker 3 0 > d path 100a > d > d ds > d pdfloc likeds(pathds) dim(10) > c > > does this look right: > > J. Scott Carter > Programmer/Analyst > e-mail: Mailto:scarter@xxxxxxxxxxx > Phone: 214.583.0348 > > It's not the destination that counts in life it's the journey. The journey > with the people we love is all that really matters. Such a simple truth so > easily forgotten. > > > _______________________________________________ > This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list > To post a message email: RPG400-L@xxxxxxxxxxxx > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/mailman/listinfo/rpg400-l > or email: RPG400-L-request@xxxxxxxxxxxx > Before posting, please take a moment to review the archives > at http://archive.midrange.com/rpg400-l. > >
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.