Page 1 of 1

Code a step in a JCL so that it actually never executes.

Posted: Wed Jul 27, 2016 11:38 am
by Krishna singh
Hi,

Here is how the question goes:

"Can we code a step in a JCL so that it actually never executes? The condition is we do not want to use the condition codes. We probably never do such a thing in production but it's an interview."

I was not able to answer this question, can somebody please help me to find an answer for this.

Re: Code a step in a JCL so that it actually never executes.

Posted: Wed Jul 27, 2016 11:46 am
by Chandan Yadav
Having COND=(0,LE) on corresponding step will suffice for bypassing the step

Thanks and regards,
Chandan

Re: Code a step in a JCL so that it actually never executes.

Posted: Wed Jul 27, 2016 5:04 pm
by Robert Sample
Chandan, did you miss this in the original post?
The condition is we do not want to use the condition codes.
Your "solution" uses condition codes, which is precisely what is NOT needed.

Krishna, JCL supports the IF statement to allow conditional execution of one or more steps. Read up on it in the JCL Reference manual so you'll be better prepared for your next interview.

Re: Code a step in a JCL so that it actually never executes.

Posted: Tue Aug 02, 2016 11:43 am
by Krishna singh
Robert Sample wrote: Chandan, did you miss this in the original post?
The condition is we do not want to use the condition codes.
Your "solution" uses condition codes, which is precisely what is NOT needed.

Krishna, JCL supports the IF statement to allow conditional execution of one or more steps. Read up on it in the JCL Reference manual so you'll be better prepared for your next interview.
Yes, we don't need to use COND, with that I knew the answer. Thanks. I think this should been the answer:

Code: Select all

//somejob JOB 
//S1      EXEC PROCNAME 
//CONDEX  IF RC = 0 THEN  
//CONSTEP   EXEC PGM=PGM1
//CONELSE   ELSE  
//CONESTP  EXEC PROCNAME1 
//        ENDIF

Re: Code a step in a JCL so that it actually never executes.

Posted: Tue Aug 02, 2016 6:52 pm
by Robert Sample
Sicne IEFBR14 always sets the return code to zero, this would meet the request:

Code: Select all

//STEP1 EXEC PGM=IEFBR14
//      IF RC > 0 THEN
//STEP2 EXEC ...
//      ENDIF
The program or procedure for STEP2 will never be executed.