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



Peter,

Igor's way will work fine since he's got the if %found().  Without the 
%found(), it would be a problem.

The simpler method is to use setll/reade

setll mykey filename;
dow not %eof(filename);
  process();
  reade mykey filename;
enddo;

You can't replace setll above with chain.

Charles Wilt
--
iSeries Systems Administrator / Developer
Mitsubishi Electric Automotive America
ph: 513-573-4343
fax: 513-398-1121
 

> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx 
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of 
> Peter.Colpaert@xxxxxxxxxx
> Sent: Thursday, August 18, 2005 10:26 AM
> To: RPG programming on the AS400 / iSeries
> Subject: Re: How to properly use %EOF() bif?
> 
> 
> Igor,
> 
> I never use %eof after a Chain.
> 
> More specifically, I never use Chain to start a loop, always setll + 
> read/reade.
> 
> Just my opinion of course, others may contradict me.  But I've never 
> encountered problems like the one you describe, so I guess my way of 
> coding seems to work.
> 
> HTH,
> 
> Peter Colpaert
> Application Developer
> Massive - Kontich, Belgium
> -----
> Yoda of Borg are we.  Futile is resistance, assimilated will you be.
> -----
> 
> 
> 
> 
> Igor.Beslic@xxxxxxxxxxxx
> Sent by: rpg400-l-bounces@xxxxxxxxxxxx
> 18/08/2005 16:17
> Please respond to RPG programming on the AS400 / iSeries
> 
>  
>         To:     rpg400-l@xxxxxxxxxxxx
>         cc: 
>         Subject:        How to properly use %EOF() bif?
> 
> 
> Hello!
> 
> Recently I've stucked with problem i resolved but still I'm 
> asking for 
> explanation. HOW %EOF() bif works? I read that resulting inds 
> are set off 
> before performing operations which affect them so I believed 
> that file 
> status BIFs (%FOUND, %EOF, %EQUAL..) work similary.
> 
> 
> I had program that read keys from array and for every key 
> chained to file 
> and read all records with current key. LOOP A describes simplified 
> process. 
> 
> LOOP A
> 
> 01 FOR COUNT=1 TO %Elem(keyARRAY);
> 02 key4file=keyARRAY(COUNT);
> 03 chain key4file KEYEDFILE;
> 04 if %Found();
> 05   dow NOT %Eof();
> 06      register();
> 07      reade key4file KEYEDFILE;
> 08   ENDDO; 
> 09  endIf;
> 10 endFor;
> 
> The problem is that loop was good just for the first 
> iteration. On second 
> iteration, when program successfuly chained to new record 
> with new key, 
> %EOF() bif in line 05 returned result that refered to last 
> READE operation 
> 
> but not CHAIN. I used this approach because I thought that 
> CHAIN is some 
> combination of SETLL+READ but obviosly I was wrong.
> 
> I altered LOOP with SETLL and READ operations as in LOOP B 
> example and now 
> 
> program process all records with keys in keyARRAY:
> LOOP B
> 
> 01 FOR COUNT=1 TO %Elem(keyARRAY);
> 02  key4file=keyARRAY(COUNT);
> 03  setll key4file KEYEDFILE;
> 04  if %Equal();
> 05    read KEYEDFILE;
> 06    dow NOT %Eof();
> 07         register();
> 08         reade key4file KEYEDFILE;
> 09    ENDDO;
> 10  endif;
> 11 endFor;
> 
> Now I'm asking is it restricted to perform only read{E,P} operations 
> before using %EOF or %BOF built in functions??
> 
> Best regards,
> Igor Bešlić, dipl. ing. rač. 
> VOLKSBANK d.d.
> OJ Informatika
> Zelinska 2, 10000 Zagreb
> tel: +385 1 6326422
> 
> 
> -- 
> 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.

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.