Page 1 of 1

Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 9:29 am
by deva_048
Step1 exec PROC1
Step2 Exec PROC2

IF PROC1 returns rc code 8 need to execute PROC1 until return code =0;
If rc= 0 then need to execute
Step2 EXEC PROC2

Is it possible to write jcl for above condition?

Re: Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 9:47 am
by steve-myers
One word: NO. You cannot form loops in JCL.

What you can do is write JCL to resubmit the same job if the step is to run again.

Re: Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 10:17 am
by deva_048
How to do that? resubmit the same job ?

Re: Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 3:54 pm
by Akatsukami
The last step (executed conditionally) is IEBGENER; SYSUT1 reads the JCL, SYSUT2 writes to the internal reader.

Re: Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 7:27 pm
by BillyBoyo
For goodness sake be very careful with that. If you get it wrong, a job which submits itself might get out-of-hand... check the CANCEL command, maybe, to see if it can kill all like-named jobs at once :-)

Re: Can we execute a same PROC again based on return code

PostPosted: Wed Jan 23, 2013 7:50 pm
by Akatsukami
BillyBoyo wrote:For goodness sake be very careful with that. If you get it wrong, a job which submits itself might get out-of-hand... check the CANCEL command, maybe, to see if it can kill all like-named jobs at once :-)

Note that Viswa asked essentially the same question nine hours earlier and got essentially the same answers, plus a warning from Dr. Sorichetti that he was treading on forbidden ground (writing a DIY job scheduler). Somehow that thread escaped the TS's notice :P