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

All sort of Mainframes Interview Questions.
Previous topicNext topic

Topic Author
Krishna singh
New Member
Posts: 6
Joined: Wed Jan 20, 2016 12:26 am

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

Post by Krishna singh » Wed Jul 27, 2016 11:38 am

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: 69
Joined: Wed Jul 31, 2013 10:19 pm
Zodiac: Libra

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

Post by Chandan Yadav » Wed Jul 27, 2016 11:46 am

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: 1328
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

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

Post by Robert Sample » Wed Jul 27, 2016 5:04 pm

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.




Topic Author
Krishna singh
New Member
Posts: 6
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 » Tue Aug 02, 2016 11:43 am

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: 1328
Joined: Fri Jun 28, 2013 1:22 am
Location: Dubuque Iowa
Zodiac: Virgo

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

Post by Robert Sample » Tue Aug 02, 2016 6:52 pm

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.



Previous topicNext topic

Return to “Interview Questions.”