Following code works without any problem on our system. We are on V5R4.
FXXFILE    if   e           k disk             
D XX1             s              1A            
D X               S              3s 0 inz      
 /Free                                         
    XX1 = 'O';                                 
                                               
      Setll (XX1: 11) XXFILE;                  
      Reade (XX1: 11) XXFILE;                  
                                               
      Dow not %eof;                            
          Eval x = X + 1;                      
          Reade (XX1: 11) XXFILE;              
      Enddo;                                   
                                               
        *inlr = *on;              	             
  /End-Free                                    
DDS source for PF
A          R XXFILE0                                       
A            FLD1           1A                             
A                                      COLHDG('FIELD 1')   
A            FLD2           2  0                           
A                                      COLHDG('FIELD 2')   
A            FLD3           1A                             
A                                      COLHDG('FIELD 3')   
A            FLD4           1A                             
A                                      COLHDG('FIELD 4')   
A          K FLD1                                          
A          K FLD2                                          
A          K FLD3                                          
FIELD 1  FIELD 2  FIELD 3  FIELD 4
   O        11       A        A   
   O        11       B        B   
   O        11       C        D   
   O        11       D        E   
   O        11       F        G   
   O        11       G        H   
********  End of data  ********   
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx
[mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Booth Martin
Sent: Thursday, August 14, 2008 2:27 PM
To: RPG programming on the AS400 / iSeries
Subject: READE in Free form, and dow not %eof
READE in Free form, and dow not %eof
Something is not working the way I expected.
I have a file with three keys.  I want to read all records (53 of them) 
where key1 = the value in XX1 and key2 = 11.
Here's what I think I have done:
FXXFILE   if   e           k disk  
   XX1 = 'O';                               
   // Retrieve XXFILE record:   
   setll (XX1: 11) XXFILE;                 
   reade (XX1: 11) XXFILE;                 
   dow not %eof;                                                
     ... stuff                        
     reade (XX1: 11) XXFILE;               
   enddo;
This all works as I expect in debug *except* that once the 53 records 
are retrieved nothing more that I can see happens.  It acts like an 
endless loop, but I just don't know what is happening.
Any suggestions would be most welcome.
                                      
As an Amazon Associate we earn from qualifying purchases.
	
 
This mailing list archive is Copyright 1997-2025 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.