|
Scott, Thanks for the info. Didn't realize it worked that way. Charles > -----Original Message----- > From: Scott Klement [mailto:klemscot@xxxxxxxxxxxx] > Sent: Friday, May 21, 2004 2:04 PM > To: RPG programming on the AS400 / iSeries > Subject: RE: Opinions Wanted: List API loop logic > > > > Hi Charles, > > > And even if the compiler did let you use a pointer as a loop > index, you'd > still have the risk of an MCH0601, because a FOR loop always > increments > the index one extra time. > > Here's a really trivial example that illustrates this: > > D x s 10I 0 > c for x = 1 to 10 > c endfor > c dsply x > c eval *inlr = *on > > What will the value of X be when it does the DSPLY? It'll > be 11. One > higher than the end of the loop... When you do that with a > pointer, you > run the risk of the MCH0601, which is what Barbara was > warning me against. > > I suppose I could write my own FOR-like op-code :)
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.