Example 1: check return codes after an asynchronous request

In this example, return codes are checked after an asynchronous request. The CHECK macro is used to cause an exit to be taken if there is a logical or physical error or if the end of the data set is reached.
REQPARMS RPL   OPTCD=ASY
         ...
         GET   RPL=REQPARMS
         LTR   15,15           Was the request completed successfully?
         BNZ   REJECTED        Zero means the request was accepted.       x
                               If not accepted, register 15 contains      x
                               4: REQPARMS is active for another          x
                               request.  Continue working on something    x
                               not dependent on the request.
 
         CHECK RPL=REQPARMS    CHECK would cause one of the three         x
                               exits to be taken if there was a logi-     x
                               cal or physical error or if the end of     x
                               the data set was reached and an active     x
                               exit list exists.
 
         LTR   15,15           Test return indication is register 15.
         BNZ   FAILURE         Zero means the request completed           x
                               successfully.  If it failed, register      x
                               15 contains 8 or 12:  there was            x
                               a logical or a physical error.
         ...
REJECTED ...
 
FAILURE  ...

Unless you provide exit routines that terminate processing, always test register 15 after the CHECK. If a routine returns to VSAM, register 15 is reset and control is passed back to your program immediately after the CHECK. An error analysis routine normally issues SHOWCB or TESTCB to examine the feedback field in the request parameter list, so that, when your processing program gets control back, it does not have to analyze the errors—but it may alter its processing if there was an error. If you do not provide an error analysis routine, your program can issue SHOWCB or TESTCB to analyze an error when it gets control back following the CHECK.