MVS JCL Abend Checks

In the case of JCL steps, where checks are made for Abends on predecessor steps, consider the following example.
If STEP010 causes an abend to occur, then JES2 will run STEP020.
If no abend occurs in STEP010, then JES2 will flush/skip STEP020 and run STEP030.

//STEP010 EXEC PGM=TESTPROG
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSABEND DD SYSOUT=*
//SYSUDUMP DD SYSOUT=*
// IF (ABEND) THEN
//STEP020 EXEC PGM=SOMEPROG
// ELSE
//STEP030 EXEC PGM=SOMEPRG2
// ENDIF

However, omitting the first step (STEP010) wherein STEP020 becomes the first step and leaving the conditional statements in the JCL
will cause JES2 to ignore any abend checks. Both STEP020 and STEP030 will be run.
// IF (ABEND) THEN
//STEP020 EXEC PGM=SOMEPROG
// ELSE
//STEP030 EXEC PGM=SOMEPRG2
// ENDIF

It is important to note that IF (ABEND) will not be triggered by non-zero return codes no matter how severe. It is simply checking for the
occurrence of a SVC-13 Abend event in the operating system.

To check for both Abend conditions and non-zero return codes in any of the preceding Job Steps the following can be used:
// IF ((ABEND) OR (RC NE 0)) THEN
//STEP020 EXEC PGM=SOMEPROG
// ENDIF

Share this post:
Share on Twitter Button   Share on Facebook Button   Share on LinkedIn Button   Share on Reddit Button

david

A developer with more than a decade of professional programming experience on multiple platforms. Windows (Win32 through .NET), as well as Web technologies.