Page 1 of 2

Prevent running a step twice

PostPosted: Fri Mar 25, 2016 6:58 pm
by samb01
Hello,

in my JCL i have, for example, three steps :



step01 exec PGM=...

step02 exec PGM=...

step03 exec PGM=...


 



the job abended in the step two : step02. So we have to restart the job at this step (step02).
But a mistake was made and the job was reruned in the beginning... so the step02 runned twice. And we have lot's of because of it (lot's of money lost...)

Is-it possible to prevent this ? I would like prevent running the step02 twice in the same occurence in TWS.

How could i do this ?

Thank's for your help.

Re: Prevent running a step twice

PostPosted: Fri Mar 25, 2016 9:04 pm
by enrico-sorichetti
the job abended in the step two : step02. So we have to restart the job at this step (step02).
But a mistake was made and the job was reruned in the beginning... so the step02 runned twice.


You meant step01 probably

if You restart at step02 it will run twice as per Your request

Re: Prevent running a step twice

PostPosted: Sat Mar 26, 2016 1:22 am
by samb01
Hello, yes i meant the step01.

But we forgot to code the restart, so the step01 has runned twice.

I would like to know, if we forgot the restart, is there any way to prevent the step01 to run twice ?

Re: Prevent running a step twice

PostPosted: Sat Mar 26, 2016 1:49 am
by Terry Heinze
Your scheduling software might be able to prevent the same job from running more than once a day. Even that has its drawbacks since a job scheduled for 11:30 PM might not run until after midnight. In the absence of scheduling software, you could update a VSAM file or DB2 (or whatever) to keep track of successfully completed steps within the job thereby bypassing those steps.

Re: Prevent running a step twice

PostPosted: Sat Mar 26, 2016 5:01 pm
by NicC
You should design the job so that it can be resubmitted with only changes that fix the problem. If that means that step 1 needs to be in a job of its own then that is how it should be designed.

There are control facilities out there that you can put in your job to do housekeeping at job start/end and set a return code from the initial housekeeping step that would allow the by-passing of steps and the re-running of steps as required by using condition codes.

Re: Prevent running a step twice

PostPosted: Sat Mar 26, 2016 6:40 pm
by willy jensen
Perhaps create a dataset in step 1, and delete it in step 3. Then the job would fail with 'dataset already exist' if restarted from the beginning.

Re: Prevent running a step twice

PostPosted: Sat Mar 26, 2016 8:07 pm
by samb01
Hello NicC, what is exactly a housekeeping ? Have you an example.

May be willy jensen had a good idea by allocatin and deletinf a dataset after the step execution..

My shceduling tool is TWS but i don't know if there's an option in TWS to prevent a step running twice in the same occurence.

Re: Prevent running a step twice

PostPosted: Sun Mar 27, 2016 4:27 am
by NicC
What do you think housekeeping is? It is clearing up either at the start of a job or at the end or both.

Re: Prevent running a step twice

PostPosted: Tue Mar 29, 2016 5:41 pm
by samb01
By code condition, is it possible to run a step junst once ?

Re: Prevent running a step twice

PostPosted: Tue Mar 29, 2016 5:50 pm
by willy jensen
Short answer: no.
Slightly longer answer: only if the code is based on some external entity like the existence of a dataset. And then you need a program i.e. IDCAMS to set that code.