×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Another suggestion is to use the whole darn subprocedure on the dow.  For 
example
dow MainGuts();
enddo;

and the subprocedure MainGuts would return an indicator variable of true 
or false to exit the loop.  I use this for traditional read loops, and for 
sql cursor fetches.

dow FetchCursor();
  // your logic here
enddo;

Two benefits:
1 - Prior to V5R4, you could keep most of your sql free format this way. 
No longer an issue with V5R4.
2 - Only 1 read or fetch.  No primer needed.
3 - If one does an iter in mid loop, you don't have an infinite loop 
because, then, you are not bypassing the actual read.  For example

fetch...; // priming read/fetch
dow 1=1;
  if z=b;
    iter;  // infinite loop
  endif;
  fetch...
enddo;

vs

dow FetchCursor();
  if z=b;
    iter;  // no longer an infinite loop
  endif;
enddo;

4 - last benefit is that you can have extensive error handling in your 
read/fetch subprocedure and not clutter up mainline.  Like who wants to 
see clutter in the mainline about a read failing NOT because you hit end 
of file, but because a read trigger says you're not authorized?

Rob Berendt

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-2026 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.