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.
The predecessor job Absences has two successor jobs, DB_BACKUP and OPERATOR_INTERVENTION, each representing a different branch and each having an internal conditional dependency on ABSENCES.
To set up this type of job processing, complete the following steps:
  1. Create the job definition and define the output conditions.
  2. Define the conditional dependency.
To create the PAYROLL job stream, complete the following steps:

Procedure

  1. Add the ABSENCES, DB_BACKUP, and OPERATOR_INTERVENTION jobs to the job stream named PAYROLL.
  2. 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.
  3. In Conditional Dependency Resolution Criteria, select Successor job runs if any of these conditions are satisfied and then select STATUS_OK.
  4. 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.
  5. In Conditional Dependency Resolution Criteria, select Successor job runs if any of these conditions are satisfied and then select STATUS_ERR1.
  6. Save the job stream.

Example

You can define the same scenario by using the composer command line as follows:
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 
For more information about defining conditional dependencies using the composer command line see Job definition, Job stream definition, and follows.