|
Peter: <snip> for %occur(mods) = 1 to 3; ..do something.. endfor; </snip> The problem with the above code is that you need a variable, not an expression. If you think back to how the following worked in RPGIII: DO 3 X ...insert your processing here ENDDO Each iteration of your do-loop incremented variable X. The same thing happens in a for-loop. In your case, you would be incrementing a variable from 1 to 3. You could do the following: D modlevel 3p 0 for modlevel = 1 to 3; %occur(mods) = modlevel; ...additional processing endfor; Perhaps one of the IBM crew can do more to explain why the BIF can't be used directly. One other point to consider: I believe the for-loop ends when the index value exceeds the limit. In my example, when modlevel > 3. If you could use the %occur(mods), you would normally want to execute your statements for all mods (just my guess). Assuming you have 3 occurrences, the last increment would set the %occur(mods) to 4, which would probably cause an error (although I suppose you could put the loop in a monitor, but that is another issue). Hope this helps --Bruce Guetzkow
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.