HCL Workload Automation, Version 9.4

Simple branch scenario

Use simple branching to evaluate the status of a job.

Simple branch usage

Based on the status returned by the job you are evaluating, a specific branch runs: if the job ends in SUCC status, the good branch runs; if the job ABENDs, the bad branch runs.

Simple branch ending in the SUCC state

Figure 1 shows the job stream definition.

Figure 1. Simple branch (SUCC) definitionA job stream defining a simple branch.

If the parent job ends in SUCC status, the bad child is canceled and the good child runs. Figure 2 shows the final state of the job stream within the current plan.

Figure 2. Simple branch (SUCC) final statusThe final status of a job stream ending in SUCC status shows that the good child was processed and bad child cancelled.

Simple branch ending in the ABEND state

Figure 3 shows the job stream definition.

Figure 3. Simple branch (ABEND) definitionDefinition of a job stream for a simple branch.

The evaluated job (that is, the parent) must have the Recovery option set to Continue, otherwise the ABENDed job does not release the branch job from the FOLLOWS dependency and the whole job stream ends in STUCK state. This is valid for all parent jobs for which you evaluate the result state, because you must consider that any job might abend.

The following example shows the log of the generic branch job instance.
============ START of branch job ===================
=============== Job environment ====================
MASTER_PLATFORM=UNIX
STREAM_NAME=SIMPLE_BRANCH_B
PARAMETER_PREFIX=
JOB_NAME=BRANCH_1
BRANCH_SUFFIX=1
PARENT=IMPORTANT_JOB_ABEND
====================================================
============= Input parameters =============
INPUT_SWITCH=PARENT_SUCCESS
ACTION_SWITCH=CANCEL
CONDITION_COUNT=0
====================================================
============= MAIN DECISION MAKING =================
Evaluation dependent on PARENT_SUCCESS
FALSE: Searched for SUCC parent. 
Status of PARENT JOB(IMPORTANT_JOB_ABEND) is ABEND.
===================================================
============= Action on STOP Branch ===============
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEC4.G_DO_THE_GOOD_THING
%cj SYDNEY#0AAAAAAAAAAAAEC4.G_DO_THE_GOOD_THING;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_LONG_ABEND[(2159 12/16/07),
   (0AAAAAAAAAAAAEC4)].G_DO_THE_GOOD_THING
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEC4.SOME_GOOD_1
%cj SYDNEY#0AAAAAAAAAAAAEC4.SOME_GOOD_1;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_LONG_ABEND[(2159 12/16/07),
   (0AAAAAAAAAAAAEC4)].SOME_GOOD_1
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEC4.SOME_GOOD_2
%cj SYDNEY#0AAAAAAAAAAAAEC4.SOME_GOOD_2;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_LONG_ABEND[(2159 12/16/07),
   (0AAAAAAAAAAAAEC4)].SOME_GOOD_2
====================================================
============= Action on RUN Branch =================
Performing action RELEASE on job SYDNEY#0AAAAAAAAAAAAEC4.B_DO_THE_BAD_THING
Releasing of job SYDNEY#0AAAAAAAAAAAAEC4.B_DO_THE_BAD_THING is NOT NECESSARY, 
   because priority=10
==========================================================
============= Statistics of branch job BRANCH_1 =============
FALSE: Searched for SUCC parent. Status of PARENT JOB(IMPORTANT_JOB_ABEND) 
is ABEND.
For action CANCEL-RUN_BRANCH=B_DO_THE_BAD_THING and STOP_BRANCH=G_DO_
THE_GOOD_THING
BRANCH selected to STOP: G_DO_THE_GOOD_THING
BRANCH selected to CONTINUE: B_DO_THE_BAD_THING
CANCELED_JOBS: G_DO_THE_GOOD_THING, SOME_GOOD_1, SOME_GOOD_2
PAUSED_JOB:
RELEASED_JOB:
============ END of branch job BRANCH_1 ==========

Required input parameters

Branching based on evaluating the status of the parent job is the most common usage of the generic branch job; it does not require any input parameters.

Placing the branch job into the job stream

Put the generic branch job into the job stream after the parent job and rename the good child with the "G_" prefix and the bad child with the "B_" prefix.

Also, follow the best practice and rename the branch job with a suffix consisting of the underscore character and a numeric value. A typical name for the first branch job within a job stream is BRANCH_1.