|
[SNIP]
> 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
[SNIP]
Your code was very close to the way that I would do it. Here's a sample
program which works for me.
D ds1 ds
D marker1 3 0
D path1 100A
D marker2 3 0
D path2 100A
D marker3 3 0
D path3 100A
D marker4 3 0
D path4 100A
D marker5 3 0
D path5 100A
D marker6 3 0
D path6 100A
D marker7 3 0
D path7 100A
D marker8 3 0
D path8 100A
D marker9 3 0
D path9 100A
D marker10 3 0
D path10 100A
D pathds ds based(@)
D marker 3 0
D path 100a
D p_pdfloc s *
D pdfloc ds likeds(pathds) dim(10)
D based(p_pdfloc)
D testpath s 52A
D x s 10I 0
/free
p_pdfloc = %addr(ds1);
// put some test data into array.
for x = 1 to 10;
pdfloc(x).marker = x + 19;
pdfloc(x).path = '/somedir/file'+%trim(%editc(x:'P'))+'.pdf';
endfor;
// at this point an "eval ds1" in debug should show the path
// info in the ds1 structure.
// now find the item with marker=24
// (should be file5.pdf)
for x = 1 to 10;
if pdfloc(x).marker = 24;
testpath = pdfloc(x).path;
endif;
endfor;
dsply '' '' testpath;
*inlr = *on;
/end-free
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.