JCL – How to Execute Only Even Steps

Here’s is resolution to execute only EVEN steps in JCL. There are multiple steps in a JCL Job. The idea is to run only even-numbered steps and skip odd-numbered steps. It’s also an interview question asked recently.

Interview question

Here are four steps in a Job, and the question is to execute only EVEN steps (2 and 4).

//JOBNAME  JOB ...  ...
//STEP01 STEP ..
//STEP02 STEP...
//STEP03 STEP...
//STEP04 STEP ...

Resolution to run only even steps

Before you try to answer. Remember these points. In JCL, you control steps execution by three methods. Those are COND, IF ELSE and RESTART parameters.

The syntax for COND:

[ ,{EVEN} {ONLY}])

I am just giving here the top methods that control job steps

  1. COND
  2. IF ELSE

Notes on these

  • COND parameters, you can give in both JOB and Step
  • RESTART Parameters only in Job card
  • IF ELSE only in STEPs


//JOBNAME  JOB ...  ...
//STEP01 STEP ..
  COND=(0, EQ, STEP02)


The RESTART at JOB card sends the control to STEP02. In STEP03, I’ve added COND=(0, EQ, STEP02). With this, it skips STEP03, as the return code from STEP02 is ‘0’. Finally, the control goes to STEP04.

Here STEP01 and STEP03 skipped and executed STEP02 and STEP04 (Even Steps).

Keep Reading

Handmade Artwork

Author: Srini

Experienced software developer. Skills in Development, Coding, Testing and Debugging. Good Data analytic skills (Data Warehousing and BI). Also skills in Mainframe.