Ü  READE(N | E) (Read Equal Key)     

·         READE reads the matching record for factor-1 and moves the pointer to the next record with the same matching criteria. If the same matching criteria is not found then it foes to EOF.

·         Factor-1 is used to place the search argument which can be the key, relative record number or field value or named constant or figurative constant used to retrieve the record.

·         SETLL with READE is best used when there can be more than one record found. For example, you can find multiple customer orders in your system for one unique customer while CHAIN is best used to locate a unique record (like a customer record).

·         Using READE, we can read all the records which match the records corresponding to search argument in factor-1. If there are no records with the specified criteria then the pointer will be set to EOF.

·         To handle READE 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

Search argument

READE(N|E)

File or record format name

Data structure to hold the result

 

Error

End of file condition indicator

 

Example

Physical file used: ACCSUBPF

Below are the records from a file ACCSUBF for party no. = ‘P00000000001’


ORG CODE  ACC NUMBER    CURRENCY  ACCOUNT MNG  COUNTRY     PARTY
190    A00000000001    EUR     DFJASHN      NKDAHFJ     P00000000001
191    A00000000002    USD     DAJFK        DAJH        P00000000001
192    A00000000003    TRY     DAHB         BJDKFA      P00000000001
193    A00000000004    USD     KIRAN        NDKAL       P00000000001
194    A00000000005    KWR     DANK         NKD         P00000000001
195    A00000000006    TRY     APPRINA      SOUTN       P00000000001
195    A00000000007    USD     SONATNA      SOUTN       P00000000001
****** ********  End of report  ********

 

 

 

Below program find all the records related to party no=‘P00000000001’ 



Columns . . . :    6  80             Browse                                  AMITCC/QRPGLESRC
SEU==>                                                                               OP_READE
FMT FX FFilename++IPEASF.....L.....A.Device+.Keywords+++++++++++++++++++++++++++++
*************** Beginning of data ****************************************************
0001.00 FACCSUBPF  IF   E           K DISK                                              130211
0002.00 DP000001          S             12A                                             130211
0003.00 C                   EVAL      P000001='P00000000001'                            130211
0004.00 C     'P00000000001'READE     ACCSUBPF                                          130211
0005.00 C                   DOW       NOT %EOF()                                        130211
0006.00 C     ACC           DSPLY                                                       130211
0007.00 C     P000001       READE     ACCSUBPF                                          130211
0008.00 C                   ENDDO                                                       130211
0009.00 C                   SETON                                        LR             130211
****************** End of data *******************************************************


 

 

OUTPUT

 

A00000000001

A00000000002

A00000000003

A00000000004

A00000000005

A00000000006

A00000000006

 





User Comments:





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