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



+1

Always prefer this approach because EOF on the first read represents a different condition (unexpected/error) whereas EOF on the second and subsequent reads is expected - in fact positively desirable!


On Nov 11, 2019, at 11:08 PM, Roger Harman <roger.harman@xxxxxxxxxxx> wrote:

Well, not trying to (re)start the top/middle-tested loop argument, but I've always preferred this...

setll (field1: field2) file1;
reade (field1: field2) file1;
dow NOT %eof(file1);

if someConditionIsMet;
...doStuff();
endif;

reade (field1: field2) file1;
enddo;


Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power



-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Joe Pluta
Sent: Monday, November 11, 2019 1:34 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: Re: IF NOT %FOUND

Yes, this is my standard process now as well.

I put a slight tweak on it:

setll (field1: field2) file1r;
dou %eof(file1);

reade (field1: field2) file1r;
if %eof(file1);
leave;
endif;

if someConditionNotMet;
iter;
endif;

...doStuff

enddo;


On 11/11/2019 3:12 PM, Greg Wilburn wrote:
I've always done mine like this

setll (field1: field2) file1r;
dou %eof(file1);
reade (field1: field2) file1r;
if not %eof(file1);
... stuff
endif;
enddo;

-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of SReeves@xxxxxxxxxxxxxxxxxx
Sent: Monday, November 11, 2019 3:13 PM
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Subject: RE: IF NOT %FOUND

Well that explains why it didn't work.

Doesn't explain why no one noticed it in over a decade ;)

Thanks






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

message: 4
date: Mon, 11 Nov 2019 18:55:45 +0000
from: Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>
subject: RE: IF NOT %FOUND

%Found isn't set on for a read.
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_72/rzasd/bbfound.htm#bbfound



End of RPG400-L Digest, Vol 18, Issue 651
*****************************************




--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com
--
This is the RPG programming on IBM i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://amazon.midrange.com


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
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.