Example 3: overlap processing

In this example, the CHECK macro is used to wait for completion of a request before continuing to other processing. Access is asynchronous.
BLOCK    ACB
LIST     RPL   ACB=BLOCK,      Asynchronous access.                     x
               AREA=WORK,                                               x
               AREALEN=50,                                              x
               OPTCD=ASY
         ...
LOOP     GET   RPL=LIST                                                 x
         LTR   15,15                                                    x
         BNZ   NOTACCEP
Do other processing:
         CHECK RPL=LIST     Suspends your processing to wait for com-   x
                            pletion of GET if necessary and to cause    x
                            VSAM to show return codes.
         LTR   15,15
         BNZ   ERROR
Process the record:
         B     LOOP
NOTACCEP ...                Request was not accepted.
ERROR    ...                Request failed.
         ...
WORK     DS    CL50         Work area.

After issuing the request, make sure that VSAM accepted it before you go on to other processing. When you have done as much other processing as you can, issue the CHECK macro. VSAM does not give you back control until the request is complete.

If you do not want to issue CHECK until you know the request is complete, use the ECB parameter of the RPL macro or the IO=COMPLETE parameter of the TESTCB macro. After you issue the CHECK, VSAM immediately returns a code and takes an exit, if necessary. See RPL—Generate a request parameter list at assembly time and GENCB—Generate a request parameter list at execution time for information on the ECB parameter.