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

All sort of Mainframes Interview Questions.

Topic author
Krishna singh
New Member
Posts: 6
Joined: Wed Jan 20, 2016 12:26 am
Has thanked: 2 times

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

Postby 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
Has thanked: 10 times
Been thanked: 7 times

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

Postby 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



Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

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

Postby 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
Has thanked: 2 times

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

Postby Krishna singh » Tue Aug 02, 2016 11:43 am

Robert Sample wrote:Source of the post 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.



Online
User avatar

Robert Sample
Global Moderator
Global Moderator
Posts: 1275
Joined: Fri Jun 28, 2013 1:22 am
Location: East Dubuque Illinois
Has thanked: 2 times
Been thanked: 90 times

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

Postby 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.




Return to “Interview Questions.”

Who is online

Users browsing this forum: CommonCrawl [Bot] and 0 guests