I think that Matt identified the crucial point - maintenance.
While I nearly always use %found() immediately following the CHAIN, the %eof() usually does not. My normal READ loop is:
SETLL *start SomeFile;
READ SomeFile;
DOW not %eof(SomeFile);
(some code)
READ SomeFile;
ENDDO;
Inserting another DOW / READ loop inside of that loop would, probably, not short-circuit the "main" DOW - but it might.
In any case, the code is obvious and explicit. And even a lousy typist like me can take the extra second or two.
Jerry C. Adams
IBM System i Programmer/Analyst
B&W Wholesale
office: 615-995-7024
email: jerry@xxxxxxxxxxxxxxx
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Tyler, Matt
Sent: Wednesday, July 02, 2008 11:49 AM
To: RPG programming on the AS400 / iSeries
Subject: RE: Standards question: What is your feeling about %found & %eof vs.%found(file) & %eof(file) ?
I always use %Eof(File), %Found(File), etc. unless I have a situation
where I need to condition data IO from many files like the following
example. I want to reduce the possibilities for run time logic errors
and using the name in the BIF prevents another from changing the code so
that the IO and the BIF test are not right next to each other.
Dou Rrn1 = Sflpage;
Select;
When Sort = 'UPC';
Read File1;
When Sort = 'DESC';
Read File2;
Endsl;
If %Eof();
Iter;
Endif;
.
.
.
Enddo;
Thanks, Matt
-----Original Message-----
From: Booth Martin [mailto:booth@xxxxxxxxxxxx]
Sent: Wednesday, July 02, 2008 10:19 AM
To: RPG programming on the AS400 / iSeries
Subject: Standards question: What is your feeling about %found & %eof
vs.%found(file) & %eof(file) ?
Standards question: What is your feeling about %found & %eof vs.
%found(file) & %eof(file) ?
We have been having a discussion about the pros & cons of these two
choices.
It would be interesting to read the thoughts of the stars and
almost-stars on this topic?
--
---------------------------------
Booth Martin
http://www.Martinvt.com
---------------------------------
--
This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.