Example 7: addressed-direct retrieval (ESDS, KSDS)

In this example, a GET macro is used to retrieve fixed-length 20-byte records. The records are to be moved to a work area.
BLOCK   ACB    DDNAME=INPUT,      Access method control                x
        .      MACRF=(ADR, DIR,   block generated at assembly.         x
        .      IN)
        .
        GENCB  BLK=RPL,           Request parameter list generated     x
               ARG=SRCHADR,       at execution.                        x
               AREA=IN,                                                x
               AREALEN=20,                                             x
               COPIES=1,                                               x
               ACB=BLOCK,                                              x
               OPTCD=(ADR, DIR,                                        x
               SYN, NUP, MVE)
 
        LTR    15,15
        BNZ    CHECK0
        LR     2, 1               Address of the list.
        .
LOOP    MVC    SRCHADR,           Search argument for retrieval;       x
                                  calculated or moved in from a table  x
                                  or a transaction record.
        GET    RPL=(2)
        LTR    15, 15
        BNZ    ERROR
        .                         Process the record.
        .
        B      LOOP
CHECK0  ...                       Generation failed.
ERROR   ...                       Request was not accepted, or failed.
        .
IN      DS     CL20               VSAM puts a record here for each     x
                                  GET request.
SRCHADR DS     CL4                You specify the RBA search argument  x
                                  here for each request.

The RBA provided for a search argument must match the RBA of a record. Keyed insertion and deletion of records in a key-sequenced data set will probably cause the RBAs of some records to change. Therefore, if you process a key-sequenced data set by addressed-direct access (or by addressed-sequential access using POINT), you need to keep track of changes. You can use the JRNAD exit for this purpose. See EXLST—Generate an exit list at assembly time.