ReadP

174 Views


READP (Read Prior Record)

The READP operation reads the prior record from a file.

The READP operation reads the prior record from FILEA.

The %EOF built-in function is set to return '1' if beginning of file is encountered.  

When %EOF returns '1', the program branches to the label BOF specified in the GOTO operation.

READP     FILEA;
IF  %EOF;
  //Logic using retrieved fields
 
ENDIF;

 

Example: Readp used with SetGt to retrieve the last used sequence number.

SetGt *HiVal FILER01;         
ReadP FILER01;                
If %EOF(FILER01);             
  SeqNbr = 1;              
Else;                          
  SeqNbr = FLDSEQ + 1;  
EndIf;                         

 

ReadP from IBM.com

Post Comments