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



It all a matter of style (or opinion if you will). I use the "if eof; leave; endif;" style. I was working on a pricing program in the last century and found an if-block that covered 33 pages. At that point I examined my programming style and swore off of long if-endif, do-loops and for-loops. So I started using Guy's second example and I found that as I was processing, if I found that the record being processed was not to be included in the report or subfile build, then a simple iter was great. This eliminated long if-blocks and shortened do-loops. But it is just a matter of style. Its not the way that I think any more, so it is not good v. bad, just different.
By the way, Cycle processing is nothing more than
Read file;
Do until *INLR;
Processing;
Read file;
Enddo;
Thanks
Marvin
----------------------------------------------------------------------

message: 1
date: Fri, 9 Jan 2009 13:06:49 -0500
from: GUY_HENZA@xxxxxxxxxxxxxx
subject: Re: Good places to use "The Cycle" in today's RPG was->Re:
FW: Niftiest thing(s) you have done in RPG ILE or /FREE

Wow, just back from lunch and so many posts. I consider ITER and LEAVE to
be backwards from the way I think. I condition on what I want to do not on
what I don't want to do.

dou eof;
read file;
if not eof;
processdata;
endif;
enddo;

This makes more sense to me than;

dou eof;
read file;
if eof;
leave;
endif;
processdata;
enddo;

That's my opinion and I'm sticking with it.

Regards,

Guy


------------------------------

message: 7
date: Fri, 9 Jan 2009 13:38:48 -0500
from: "Jeff Crosby" <jlcrosby@xxxxxxxxxxxxxxxx>
subject: RE: Good places to use "The Cycle" in today's RPG was->Re:
FW: Niftiest thing(s) you have done in RPG ILE or /FREE

I do it the way you don't.

dow '1';
read file;
if eof;
leave;
endif;
processdata;
enddo;

That's MY opinion and I'm sticking to it. <g>

--
Jeff Crosby
UniPro FoodService/Dilgard
P.O. Box 13369
Ft. Wayne, IN 46868-3369
260-422-7531
www.dilgardfoods.com

The opinions expressed are my own and not necessarily the opinion of my
company. Unless I say so.


As an Amazon Associate we earn from qualifying purchases.

This thread ...


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.