Setting up conditional dependencies
You can set up conditional dependencies to define workflows with alternative branches based on conditions.
About this task
Using conditional dependencies you can control when a successor job starts depending on the combination of one or more mapping expressions (for example, return codes) or statuses of a predecessor job.
Ensure that all the components in the IBM Workload Scheduler environment are at version 9.3, Fix Pack 1, or later.
In the following example, the DB_BACKUP job runs if the ABSENCES job
satisfies the condition associated with the STATUS_OK , and the OPERATOR_INTERVENTION job runs if
the ABSENCES job satisfies the condition defined for STATUS_ERR1.
To set up this type of job processing, complete the following steps:
To create the PAYROLL job stream, complete the following steps: To set up this type of job processing, complete the following steps:
- Create the job definition and define the output conditions.
- Define the conditional dependency.
Procedure
- Add the ABSENCES, DB_BACKUP, and OPERATOR_INTERVENTION jobs to the job stream named PAYROLL.
- Add a dependency, in this case an internal dependency, to the DB_BACKUP job. In the properties of the internal job dependency, choose to make this a conditional dependency by selecting the Conditional Dependency check box.
- In Conditional Dependency Resolution Criteria, select Successor job runs if any of these conditions are satisfied and then select STATUS_OK.
- Add a dependency to the OPERATOR_INTERVENTION job. In the properties of the internal job dependency, choose to make this a conditional dependency by selecting the Conditional Dependency check box.
- In Conditional Dependency Resolution Criteria, select Successor job runs if any of these conditions are satisfied and then select STATUS_ERR1.
- Save the job stream.
Example
- Job definition
WK1#ABSENCES SCRIPTNAME "myscript.sh" STREAMLOGON root DESCRIPTION "Sample Job Definition" TASKTYPE UNIX SUCCOUTPUTCOND STATUS_OK "RC=0” OUTPUTCOND STATUS_ERR1 “RC =2” RECOVERY CONTINUE END
- Job stream
SCHEDULE WK1#PAYROLL ON RUNCYCLE RULE1 "FREQ=DAILY;" AT 1800 CARRYFORWARD : WK1#DB_BACKUP FOLLOWS WK1#ABSENCES IF STATUS_OK WK1#OPERATOR_INTERVENTION FOLLOWS WK1#ABSENCES IF STATUS_ERR1 END