EXIT statement

The EXIT statement immediately terminates the operation of an ACS routine.

EXIT <CODE(n)> Figure 1 shows an example of an EXIT statement:
Figure 1. Example of an EXIT Statement
PROC STORCLAS
  FILTLIST SECVOL INCLUDE(PAY*, REC*) EXCLUDE('PAYR20', 'REC195')
  FILTLIST VALID_UNITS  INCLUDE('3380','3390','SYSDA','')
  IF &UNIT ¬= &VALID_UNITS THEN

     DO
        SET &STORCLAS = '
        EXIT
     END

  IF &ALLVOL ¬= &SECVOL THEN EXIT CODE(22)

END

If the first IF statement is true (&UNIT does not match any unit named in the VALID_UNITS filter criteria), then execution of this ACS routine terminates immediately. Allocation proceeds, because the exit code is zero, the default.

If the second IF statement is true (none of the input volumes match the SECVOL FILTLIST criteria), then execution of this ACS routine terminates immediately and the allocation fails. The value for CODE, 22, is set and displayed as part of the allocation failed error message written to the end user.