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

All sort of Mainframes Interview Questions.
Post Reply
Krishna singh
New Member
Posts: 7
Joined: Wed Jan 20, 2016 12:26 am

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

Post 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.
Chandan Yadav
Website Team
Website Team
Posts: 70
Joined: Wed Jul 31, 2013 10:19 pm

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

Post by Chandan Yadav »

Having COND=(0,LE) on corresponding step will suffice for bypassing the step

Thanks and regards,
Chandan
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Krishna singh
New Member
Posts: 7
Joined: Wed Jan 20, 2016 12:26 am

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

Post 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
Last edited by Anuj Dhawan on Tue Aug 02, 2016 9:57 pm, edited 1 time in total.
Reason: Added code tags.
User avatar
Robert Sample
Global Moderator
Global Moderator
Posts: 1891
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
United States of America

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

Post 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.
Post Reply

Create an account or sign in to join the discussion

You need to be a member in order to post a reply

Create an account

Not a member? register to join our community
Members can start their own topics & subscribe to topics
It’s free and only takes a minute

Register

Sign in

Return to “Interview Questions.”