× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




On Tuesday, February 17, 2004, at 09:54 AM, Bartell, Aaron L. (TC) wrote:


Just curious, what would you do differently with the following code? Notice
how I have a DO loop (without conditions) wrapping this entire section of
code. If an error is encountered I call the $Error subroutine and ITER my
way out of the loop to avoid more errors. This goes back to my second email
where I said I should have had more ITERs within my loop.

That's like asking for directions to Portrush. If I were going to Portrush I wouldn't start from here at all.


First, DO on its own just DOes once so there is little point in it. Second, ITER branches to the loop condition; what you really want to do is leave the loop so LEAVE would be more appropriate than ITER. ITER works in this case **ONLY** because your loop executes only once. I think that is an appalling use of a loop construct because you don't want to loop at all. See Paul Tuohy's append for an example of what you should have coded. Even without SELECT you can do this with IF and ELSE conditions. There is no need for DO and ITER.

Now come up with a proper looping example which you think requires LEAVE and ITER.

Regards,
Simon Coulter.
--------------------------------------------------------------------
   FlyByNight Software         AS/400 Technical Specialists

   http://www.flybynight.com.au/
   Phone: +61 3 9419 0175   Mobile: +61 0411 091 400        /"\
   Fax:   +61 3 9419 0175                                   \ /
                                                             X
                 ASCII Ribbon campaign against HTML E-Mail  / \
--------------------------------------------------------------------



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.