Ü READP (N | E)  (Read Prior Record)        

·         READP moves the pointer to the previous record and reads the record and again moves the pointer to next previous position. If there are no more records it sets EOF *ON.

·         To handle READP exceptions (file status codes greater than 1000), either the operation code extender 'E' or an error indicator at LO level can be used.

·         If the data-structure is specified in result field then the result of the operation is filled in the data structure.

·         The Equal Indicator gets turned-on if the EOF condition is met else it will be off. Instead of using this indicator we can also go for %EOF().

Factor 1

Op-code

Factor 2

Result Field

Resulting Indicators

       HI                            LO                      EQ

 

READP(N|E)

File or record format name

Data structure to hold the result

 

Error

Beginning of file condition indicator

 


Example

  I.            To read the file in reverse order

PF0001 = Physical file used

       PNAME       PNUM          PADDR       OPNDD  OPNMM  OPNYY   OPNSTS
000001 AMINEM      P00000000001  CONIZA TOJ     2      1   2,012      1
000002 IROBO       P00000000002  HENGURIZZA     1      6   2,012      1
000003 ZENNIE      P00000000003  UENAI         13      1   2,012      2
000004 JOHNNE      P00000000004  HOLLYNIA      14      2   2,011      1
****** ********  End of report  ********



 


Columns . . . :    6  80                Browse                               AMITCC/QRPGLESRC
SEU==>                                                                               OP_READP
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 FPF0001    IF   E           K DISK                                              130211
0002.00 C     *HIVAL        SETLL     PF0001                                            130211
0003.00 C                   READP     PF0001                                            130211
0004.00 C                   DOW       NOT %EOF()                                        130211
0005.00 C     PNUM          DSPLY                                                       130211
0006.00 C                   READP     PF0001                                            130211
0007.00 C                   ENDDO                                                       130211
0008.00 C                   SETON                                        LR             130211
****************** End of data *******************************************************

 

OUTPUT

P00000000004        

P00000000003        

P00000000002        

P00000000001        

 





User Comments:





Copyright © Go4as400.com, 2013-2017. Copyright notice