Prevent running a step twice



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

Prevent running a step twice

Postby samb01 » Fri Mar 25, 2016 6:58 pm

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.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Prevent running a step twice

Postby enrico-sorichetti » Fri Mar 25, 2016 9:04 pm

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
cheers
enrico
When I tell somebody to RTFM or STFW I usually have the page open in another tab/window of my browser,
so that I am sure that the information requested can be reached with a very small effort
enrico-sorichetti
Global moderator
 
Posts: 2994
Joined: Fri Apr 18, 2008 11:25 pm
Has thanked: 0 time
Been thanked: 164 times

Re: Prevent running a step twice

Postby samb01 » Sat Mar 26, 2016 1:22 am

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 ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Prevent running a step twice

Postby Terry Heinze » Sat Mar 26, 2016 1:49 am

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.
.... Terry
Terry Heinze
 
Posts: 239
Joined: Wed Dec 04, 2013 11:08 pm
Location: Richfield, MN, USA
Has thanked: 12 times
Been thanked: 11 times

Re: Prevent running a step twice

Postby NicC » Sat Mar 26, 2016 5:01 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Prevent running a step twice

Postby willy jensen » Sat Mar 26, 2016 6:40 pm

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.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Re: Prevent running a step twice

Postby samb01 » Sat Mar 26, 2016 8:07 pm

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.
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Prevent running a step twice

Postby NicC » Sun Mar 27, 2016 4:27 am

What do you think housekeeping is? It is clearing up either at the start of a job or at the end or both.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisies (almost)
Has thanked: 4 times
Been thanked: 136 times

Re: Prevent running a step twice

Postby samb01 » Tue Mar 29, 2016 5:41 pm

By code condition, is it possible to run a step junst once ?
samb01
 
Posts: 427
Joined: Mon Nov 16, 2009 7:24 pm
Has thanked: 1 time
Been thanked: 0 time

Re: Prevent running a step twice

Postby willy jensen » Tue Mar 29, 2016 5:50 pm

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.
willy jensen
 
Posts: 455
Joined: Thu Mar 10, 2016 5:03 pm
Has thanked: 0 time
Been thanked: 69 times

Next

Return to JCL

 


  • Related topics
    Replies
    Views
    Last post