Can we execute a same PROC again based on return code



JES, JES2, JCL utilities, IDCAMS, Compile & Run JCLs, PROCs etc...

Can we execute a same PROC again based on return code

Postby deva_048 » Wed Jan 23, 2013 9:29 am

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?
deva_048
 
Posts: 72
Joined: Thu Feb 02, 2012 9:28 pm
Has thanked: 1 time
Been thanked: 0 time

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

 

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

Postby steve-myers » Wed Jan 23, 2013 9:47 am

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.
steve-myers
Global moderator
 
Posts: 1885
Joined: Thu Jun 03, 2010 6:21 pm
Has thanked: 4 times
Been thanked: 197 times

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

Postby deva_048 » Wed Jan 23, 2013 10:17 am

How to do that? resubmit the same job ?
deva_048
 
Posts: 72
Joined: Thu Feb 02, 2012 9:28 pm
Has thanked: 1 time
Been thanked: 0 time

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

Postby Akatsukami » Wed Jan 23, 2013 3:54 pm

The last step (executed conditionally) is IEBGENER; SYSUT1 reads the JCL, SYSUT2 writes to the internal reader.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

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

Postby BillyBoyo » Wed Jan 23, 2013 7:27 pm

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 :-)
BillyBoyo
Global moderator
 
Posts: 3804
Joined: Tue Jan 25, 2011 12:02 am
Has thanked: 22 times
Been thanked: 264 times

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

Postby Akatsukami » Wed Jan 23, 2013 7:50 pm

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
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times


Return to JCL

 


  • Related topics
    Replies
    Views
    Last post