× 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



Don Brown


From: "Roger Harman" <roger.harman@xxxxxxxxxxx>
To: "RPG programming on IBM i" <rpg400-l@xxxxxxxxxxxxxxxxxx>
Date: 12/11/2019 02:08 PM
Subject: RE: IF NOT %FOUND
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>



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
*****************************************





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.