Testing for an abend condition

When a job step abends, the system scans the remaining steps for an IF/THEN/ELSE/ENDIF statement construct that tests for an abend or abend completion code. If none is present, the system terminates the job.

Code one of the following to execute an error routine program after an abend:
   //IFBAD      IF    (ABEND)   THEN
   //ERROR      EXEC  PGM=ERRRTN
   //           ENDIF
   //NEXTSTEP   EXEC

                 or:

   //IFBAD      IF    (ABEND=TRUE)   THEN
   //ERROR      EXEC   PGM=ERRRTN
   //           ENDIF
   //NEXTSTEP   EXEC  

The system executes step ERROR only when one or more of the preceding steps abnormally terminates.