Tivoli Workload Scheduler [TWS] Conditional Dependency - How to implement?

3.6k views Asked by At

I am reaching to SME on the subject after trying to figure out the solution of below scenario. I have a very specific requirement:

1) Say I have a schedule called SCH1, having 3 jobs JOB1, JOB2 and JOB3 like:

Schedule S1
JOB1

JOB2
FOLLOWS JOB1

JOB3
FOLLOWS JOB2

END

2) The JOB1 is calling a shell script. 3) Now if JOB1 shell script returns a code 0 – it is successful and execute JOB2 and JOB3. 4) If shell script returns code is anything other than 0, Still the JOB1 should not abend; but all other job JOB2 and JOB3 should be skipped (or completed without run); and schedule should be marked successful.

I got below link online, which suggest that this should be possible. But when I refer to syntax for Job/Schedule definition; I am not able to figure out that how it should be written.

In the job syntax, it looks like that below can do the trick, but not so sure.

 [rccondsucc "Success Condition"] 
   [recovery 
        {stop | continue | rerun}
        [after [workstation#]jobname] 
        [abendprompt “text”] ]

Conditional Dependency:

http://www-01.ibm.com/support/knowledgecenter/SSGSPN_9.1.0/com.ibm.tivoli.itws.doc_9.1/zos/src_man/eqqr1conddepevalex.htm?lang=en

Job syntax:

http://www-01.ibm.com/support/knowledgecenter/SSGSPN_9.1.0/com.ibm.tivoli.itws.doc_9.1/distr/src_ref/awsrgjobdefn.htm?lang=en

Schedule syntax:

http://www-01.ibm.com/support/knowledgecenter/SSGSPN_9.1.0/com.ibm.tivoli.itws.doc_9.1/distr/src_ref/awsrgjsdefn.htm?lang=en

3

There are 3 answers

0
snaguber On

I would say this is not possible.

With RCCONDSUCC you can fine tune the status of a job (SUCC or ABEND) depending on it's return code. This just means you are not limited to RC = 0 = SUCC or RC > 0 = ABEND.

With RECOVERY you can specify which action should be taken only when the JOB is in ABEND.

Here you want to force a JOB to SUCC and specify a RECOVERY....

2
Michael Glatz On

To skip Job2 and Job3 with the help of Conditional dependencies Job1 must be in status "E". But you can add a Job4 to application that only runs if Job1 aborted (also defined with CondDep). This job completes Job1 (or whole application). It works - I demonstrated just this example on customer meeting :-)

It is also possible that Job1 completes and jobs Job2 and Job3 are skipped if these jobs have CondDep to Job1: Job1 must be in status "C" AND Job1 must end with RC<>0.

0
Franco Mossotto On

Since 9.3 FP1 this can be implemented with built-in conditional dependencies

Assuming you want JOB3 to wait if JOB2 abends, using conditional dependencies your scenario can be implemented like this
enter image description here

 SCHEDULE SCH1 
 :
 JOB1
  DOCOMMAND "myscript"
  STREAMLOGON twsuser
  SUCCOUTPUTCOND GO "RC=0"
  SUCCOUTPUTCOND NOGO "RC!=0"

 JOB2
  FOLLOWS JOB1 IF GO

 JOB3
  FOLLOWS JOB2
  FOLLOWS JOB1 IF GO
 END

JOB1 has 2 SUCCOUTPUTCOND defined: GO if RC=0 and NOGO if RC!=0. Both are SUCCOUTPUTCOND, meaning that JOB1 will go in SUCC in both cases.

  • If JOB1 ends with RC=0, the GO condition is true and the FOLLOWS JOB1 IF GO dependencies are satisfied, so JOB2 and JOB3 can be run (JOB3 will wait JOB2 since it has also a FOLLOWS JOB2)
  • If JOB1 ends with a RC that is not 0, GO is false and NOGO is true. Since at least on SUCCOUTPUTCOND is true, JOB1 completes in SUCC, but the FOLLOWS JOB1 IF GO are not satisfied and JOB2 and JOB3 would be set to SUPPR status and will not run.