Page 1 of 1

Execute a specific step in a JCL.

Posted: Wed Aug 17, 2016 2:29 pm
by Shaifali Kapoor
Hi,

In a JCL which have 100 steps. In that, if I want to execute only the 13th step then I can by using RESTART=STEP13 in the job card. I alos need to put a null statement after the 13th step. Is there any other way to do this? I do not a way of doing it. Can there beother way, please suggest me. I faced this in an iterview which went almost good apart from this question.

Re: Execute a specific step in a JCL.

Posted: Wed Aug 17, 2016 2:57 pm
by Akatsukami
First of all, realize that this a trick question; you'd seldom if ever want to do this in real life.

Possible ways of doing this would be:
  • Deleting all lines after STEP13, and either using the TSO SUBMIT command or writing the modified JCL to the internal reader, depending on the environment.
  • Enclosing STEP14 through STEP100 in a suitable IF-THEN-ELSE construct.

Re: Execute a specific step in a JCL.

Posted: Wed Aug 17, 2016 11:39 pm
by Chandan Yadav
Hi,

Just adding one more way to Akatsukami..
Code

Code: Select all

Restart =STEP13,COND=(0,LE)  
on Job card

Re: Execute a specific step in a JCL.

Posted: Thu Aug 18, 2016 12:53 am
by enrico-sorichetti
and ... what would be a practical use of this horse manure(*)


(*)
normally horse manure would be much more useful than these kind of gimmiks

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 2:02 pm
by Shaifali Kapoor
Akatsukami wrote: First of all, realize that this a trick question; you'd seldom if ever want to do this in real life.

Possible ways of doing this would be:
  • Deleting all lines after STEP13, and either using the TSO SUBMIT command or writing the modified JCL to the internal reader, depending on the environment.
  • Enclosing STEP14 through STEP100 in a suitable IF-THEN-ELSE construct.
Thanks for the other options. I have ore answer for the interview. :)

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 2:03 pm
by Shaifali Kapoor
enrico-sorichetti wrote: and ... what would be a practical use of this horse manure(*)


(*)
normally horse manure would be much more useful than these kind of gimmiks
Not sure what do you want to say. I was just thimking if I can prepare better for next interview. Please advise if I should have asked it some other forum?

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 2:05 pm
by Shaifali Kapoor
Chandan Yadav wrote: Hi,

Just adding one more way to Akatsukami..
Code

Code: Select all

Restart =STEP13,COND=(0,LE)  
on Job card
Thanks for the other option Chandan. But if add only this steps after 13 will anyways get executed?

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 2:24 pm
by Preeti Ganesh
Hi,

We can also make use of IEBEDIT.

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 5:51 pm
by Chandan Yadav
Shaifali Kapoor wrote: thanks for the other option Chandan. But if add only this steps after 13 will anyways get executed?
Once your step 13 executed with Restart parameter then COND parameter on JOb card will be applicable to all other steps and (0,LE) will be always true

Re: Execute a specific step in a JCL.

Posted: Fri Aug 19, 2016 7:45 pm
by msivakarthikmf
This would include Step name STEP010 of Jcl JOBNAM1 present in library
USERID.ABC.JCLLIB

Code: Select all

//IEBEDITA JOB (XXXXXXXX,,,,,XXXX),'       ',CLASS=T,         
//            MSGCLASS=Y,NOTIFY=&SYSUID                       
//*===========================================================
//* EXAMPLE FOR IEBEDIT UTILITY                               
//*===========================================================
//STEP001  EXEC PGM=IEBEDIT                                   
//SYSUT1   DD  DSN=USERID.ABC.JCLLIB(JOBNAM1),DISP=SHR    
//SYSUT2   DD  SYSOUT=(*,INTRDR)                              
//SYSPRINT DD  SYSOUT=*                                       
//SYSIN    DD  *                                              
  EDIT TYPE=INCLUDE,STEPNAME=(STEP010)                       
/*

Re: Execute a specific step in a JCL.

Posted: Mon Aug 22, 2016 1:53 pm
by Preeti Ganesh
msivakarthikmf wrote: This would include Step name STEP010 of Jcl JOBNAM1 present in library
USERID.ABC.JCLLIB

Code: Select all

//IEBEDITA JOB (XXXXXXXX,,,,,XXXX),'       ',CLASS=T,         
//            MSGCLASS=Y,NOTIFY=&SYSUID                       
//*===========================================================
//* EXAMPLE FOR IEBEDIT UTILITY                               
//*===========================================================
//STEP001  EXEC PGM=IEBEDIT                                   
//SYSUT1   DD  DSN=USERID.ABC.JCLLIB(JOBNAM1),DISP=SHR    
//SYSUT2   DD  SYSOUT=(*,INTRDR)                              
//SYSPRINT DD  SYSOUT=*                                       
//SYSIN    DD  *                                              
  EDIT TYPE=INCLUDE,STEPNAME=(STEP010)                       
/*
Thanks. Ido see IEBEDIT answer on many places on websites but in my real JCLS I have at work place I have never seen it being used. Is it used only in theory and for interviews?

Re: Execute a specific step in a JCL.

Posted: Mon Aug 22, 2016 1:57 pm
by Preeti Ganesh
Chandan Yadav wrote:
Shaifali Kapoor wrote: thanks for the other option Chandan. But if add only this steps after 13 will anyways get executed?
Once your step 13 executed with Restart parameter then COND parameter on JOb card will be applicable to all other steps and (0,LE) will be always true
COND=(0,LE) is like, if the RC of the previous step is less than 0 don't execute "step13", which is not possible. So agree step13 would execute but rest of the steps will also execute. I was not supposed to execute step15, step15...

Re: Execute a specific step in a JCL.

Posted: Mon Aug 22, 2016 6:06 pm
by nicc
IEBEDIT is a standard IBM utility. Refer to the utilities manual for information.

Re: Execute a specific step in a JCL.

Posted: Mon Aug 22, 2016 6:21 pm
by Robert Sample
COND=(0,LE) is like, if the RC of the previous step is less than 0 don't execute "step13", which is not possible. So agree step13 would execute but rest of the steps will also execute. I was not supposed to execute step15, step15...
A job COND parameter applies to all steps, so the COND=(0,LE) would apply to all steps after STEP13.

Re: Execute a specific step in a JCL.

Posted: Mon Aug 22, 2016 10:21 pm
by Chandan Yadav
Preeti Ganesh wrote: COND=(0,LE) is like, if the RC of the previous step is less than 0 don't execute "step13", which is not possible. So agree step13 would execute but rest of the steps will also execute. I was not supposed to execute step15, step15...
As Robert mentioned When I mention COND on JOB parameter it will applicabe to all steps of Jobs, as I am restarting from step 13 it will anyways execute as there is no previous COND parameter to check.
Once Step 13 executed it will apply COND=(0,LE) to all other steps and COND=(0,LE) is like the RC of the previous step is less than or equal to 0 don't execute

I hope its clear else I can suggest you to test it out and let us know if something not working :)

Thanks,
Chandan