Pause and Release actions scenario
Use this branch job to manage a job stream that is sensitive to some important job results, for example, to consider when the action performed by an important job did not complete successfully.
Pause and Release actions usage
Use the pause and release scenario when, even if the branch job identified an error state, you do not want to cancel the branches. Instead of immediate canceling, you make the job run a sequence of corrective actions. If the actions succeed, the job continues as if the error did not occur.
The process flow looks like the following example:
- You have an important job that is followed by the first branch job.
- The branch job is followed by a good branch and a bad branch: the good branch (named OKbranch) includes the jobs to run if everything is successful and the bad branch (named Correctivebranch) includes a sequence of jobs to perform corrective actions.
- The first branch job evaluates the
condition run against the parent job (your important job):
if CONDITION=TRUE, everything is successful and the stop branch is
canceled. All the jobs in the corrective branch are also canceled,
because no corrective action is needed.
If CONDITION=FALSE, the stop branch is not canceled but is paused, meaning that the good child (the first job of the stop branch) is paused. By pausing the good child, the OKbranch is being HELD.
- While the OKbranch is being paused, the corrective branch starts corrective actions.
- After the sequence of corrective
actions completes, the second branch job (placed within the corrective
branch) is submitted to evaluate the result of the corrective actions.
If the corrective actions succeed, the OKbranch is released; if the corrective actions fail, the OKbranch is canceled and the job stream continues to run the bad branch of the second branch job.
Usually, the bad branch of the second branch job contains only one ABEND job (a job that performs an exit 1 command). It is a good practice to end the bad branch of the corrective branch with the ABEND job, because it ensures that the whole job stream abends (the previous abended jobs had Recovery Option=CONTINUE, so they did not propagate the ABEND status to the final job stream status).
Figure 1 shows the job stream definition for the pause/release scenario. The ACTION_SWITCH=PAUSE parameter is defined for the first branch job. No parameters are defined for the second branch job.
The following job log shows the output of the first branch job instance:
============ START of branch job BRANCH_1 ==========
================= Job environment ==================
MASTER_PLATFORM=UNIX
STREAM_NAME=GBJ_PAUSE
STREAM_CPU=SYDNEY
BRANCH_JOB_NAME=BRANCH_1
PARENT=IMPORTANT_JOB_ABEND
==========================================================
============= Input parameters =============
CONDITION_SWITCH=PARENT_SUCCESS
ACTION_SWITCH=PAUSE
==========================================================
============= 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 PAUSE on job SYDNEY#0AAAAAAAAAAAAEEX.G_DO_THE_GOOD_THING
%altpri SYDNEY#0AAAAAAAAAAAAEEX.G_DO_THE_GOOD_THING;schedid;0;noask
Command forwarded to batchman for SYDNEY#GBJ_PAUSE[(2300 12/17/07),
(0AAAAAAAAAAAAEEX)].G_DO_THE_GOOD_THING
==========================================================
============= Action on RUN Branch =============
Performing action RELEASE on job
SYDNEY#0AAAAAAAAAAAAEEX.B_PERFORM_CORRECTIVE_ACTIONS
Releasing of job SYDNEY#0AAAAAAAAAAAAEEX.B_PERFORM_CORRECTIVE_ACTIONS
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 PAUSE - RUN_BRANCH=B_PERFORM_CORRECTIVE_ACTIONS
and STOP_BRANCH=G_DO_THE_GOOD_THING
BRANCH selected to STOP: G_DO_THE_GOOD_THING
BRANCH selected to CONTINUE: B_PERFORM_CORRECTIVE_ACTIONS
CANCELED_JOBS:
PAUSED_JOB: G_DO_THE_GOOD_THING
RELEASED_JOB:
============ END of branch job BRANCH_1 ==========
The following job log shows the output of the second branch job instance:
============ START of branch job BRANCH_2 ==========
==========================================================
============= Job environment =============
MASTER_PLATFORM=UNIX
STREAM_NAME=GBJ_PAUSE
STREAM_CPU=SYDNEY
BRANCH_JOB_NAME=BRANCH_2
PARENT=SOME_CORRECTIVE_JOB_2
==========================================================
============= Input parameters =============
CONDITION_SWITCH=PARENT_SUCCESS
ACTION_SWITCH=CANCEL
==========================================================
============= MAIN DECISION MAKING =============
Evaluation dependent on PARENT_SUCCESS
TRUE: Searched for SUCC parent. Status of
PARENT JOB(SOME_CORRECTIVE_JOB_2) is SUCC.
==========================================================
============= Action on STOP Branch =============
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEEX.B_ABEND_JOB
%cj SYDNEY#0AAAAAAAAAAAAEEX.B_ABEND_JOB;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_PAUSE[(2300 12/17/07),
(0AAAAAAAAAAAAEEX)].B_ABEND_JOB
==========================================================
============= Action on RUN Branch =============
Performing action RELEASE on job
SYDNEY#0AAAAAAAAAAAAEEX.G_DO_THE_GOOD_THING
Releasing SYDNEY#0AAAAAAAAAAAAEEX.G_DO_THE_GOOD_THING, because priority=0
%altpri SYDNEY#0AAAAAAAAAAAAEEX.G_DO_THE_GOOD_THING;schedid;10;noask
Command forwarded to batchman for SYDNEY#GBJ_PAUSE[(2300 12/17/07),
(0AAAAAAAAAAAAEEX)].G_DO_THE_GOOD_THING
==========================================================
============= Statistics of branch job BRANCH_2 =============
TRUE: Searched for SUCC parent. Status of
PARENT JOB(SOME_CORRECTIVE_JOB_2) is SUCC.
For action CANCEL - RUN_BRANCH=G_DO_THE_GOOD_THING and
STOP_BRANCH=B_ABEND_JOB
BRANCH selected to STOP: B_ABEND_JOB
BRANCH selected to CONTINUE: G_DO_THE_GOOD_THING
CANCELED_JOBS: B_ABEND_JOB
PAUSED_JOB:
RELEASED_JOB:G_DO_THE_GOOD_THING
============ END of branch job BRANCH_2 ==========
Required input parameters
Table 1 shows the parameters required for the first branch job of the pause/release scenario. The second branch job does not require any parameters.
Parameter name | Parameter value |
---|---|
ACTION_SWITCH | PAUSE |
- The parameter ACTION_SWITCH=PAUSE is required only for the first branch job within the job stream. The second branch job must have ACTION SWITCH=CANCEL (this the default value).
- Both branch jobs must point to the same good child.
- Each branch job must have a different suffix. For example, in this simple pause and release scenario, two branch job names are used: BRANCH_1 and BRANCH_2.
The parameter definition looks like the following example. The text is entered into the Comments field of the job stream definition.
BRANCH_1-BEGIN
ACTION_SWITCH=PAUSE
BRANCH_1-END
For a description about how to specify the parameters to the branch job, see Specifying the branch job 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.
The first branch job determines the OKbranch (followed by the good child) and the CorrectiveBranch (followed by the bad child). The job representing the good child must have the "G_" prefix, while the job representing the bad child must have the "B_" prefix."
Both branch jobs must point to the same good child. This means that the good child of the first branch job must be identical to the good child of the second branch job.
The best practice is to place the ABEND job as the bad child of the second branch job. The ABEND job just calls system command exit 1 , which causes the job to ABEND.
Having an ABEND job in the bad branch ensures that the ABEND status is propagated also to the job stream level. Any previously ABENDed jobs would not propagate the ABEND state to the job stream level if the job has the Recovery Option set to Continue. To allow the branch job to run, you must set the Recovery Option to Continue for all the branch job parents.