Sign In

Dz Challenge: Tips and Techniques Got a great tip or technique to share?
z & A > Dz Challenge: Tips and Techniques > Never start JCL step with negative condition View modes: 
User avatar
Guest
Srirama - 12/7/2012 12:05:03 AM
   
Never start JCL step with negative condition
Question: Do you know that there is a possibility that your JCL can run both the IF as well as the ELSE statement ( in a very special case)?

The below JCL will run both the IF and ELSE statement. What’s wrong with this?
// simple JOB CARD
// SET STAT='FALSE'
//*
// IF &STAT THEN
//STAA EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//*
// ELSE
//STBB EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
// ENDIF

Answer: No condition statement, (or) IF statements work on the first STEP of a JCL. Also, you cannot restart a JCL from a STEP which is expected to face the check, for a negative condition.
This is something very fundamental of JCL, and many of us may not know. A common pitfall.

Solution to the Above, Put a DUMMY IEFBR14 step, just before any JCL which is most expected to face the check, for a negative condition. Also, never restart a JCL from a step facing negative condition check.


1