Example 5: sequential retrieval for a fixed-Length RRDS

In this example, a GET macro is used to sequentially retrieve records by relative record number. Fixed-length, 100-byte records are moved to a work area. Processing is synchronous.
INPUT    ACB   MACRF=(KEY,SEQ)  All MACRF and OPTCD subparameters      x
                                are defaults and could be omitted.
RETRVE   RPL   ACB=INPUT,                                              x
               AREA=IN,                                                x
               AREALEN=100,                                            x
               ARG=RCDNO,                                              x
               OPTCD=(KEY,SEQ,                                         x
               SNY,NUP,MVE)
         .
LOOP     GET   RPL=RETRVE       This GET or identical GETs can be      x
                                issued, with no change in the RPL, to  x
                                retrieve subsequent records in         x
                                relative record number sequence.
         LTR   15,15
         BNZ   ERROR
         .
         B     LOOP
ERROR    ...                    Request was not accepted or it failed.
         .
IN       DS    CL100            IN contains a data record after GET is x
                                completed.
RCDNO    DS    CL4              VSAM returns relative record number of x
                                retrieved record in this field.

The records are retrieved in relative record number sequence. Empty records are bypassed for sequential retrieval. A 4-byte search argument must be specified. The relative record number of each record retrieved is stored in the search argument. VSAM is positioned at the first relative record when the data set is opened, and the next not empty record is retrieved automatically as each GET is issued. The branch to ERROR is taken when the end of the data set is reached.