HCL Workload Automation, Version 9.4

Complex scenario - Multiple conditions

Use the multiple conditions scenario to set multiple sub -conditions at the same time.

Complex condition usage

This section describes how you put all the atomic elements of a complex condition together. The generic branch job gets the parent job log and run a complex condition against it:

  • The job log must not include the pattern Error.

and

  • One of the following atomic conditions must be satisfied:
    • The free space on the Primary device is known, and its value is greater than 50.
    • The free space on the Secondary device is known, and its value is greater than 60.

Figure 1 shows the definition for the complex branch scenario.

Figure 1. Complex condition definitionDefinition of a job stream with multiple sub-conditions.

The job log shows the output of the generic branch job instance:

============ START of branch job BRANCH_1 ==========
================ Job environment ===================
MASTER_PLATFORM=UNIX
STREAM_NAME=GBJ_COMPLEX
STREAM_CPU=SYDNEY
BRANCH_JOB_NAME=BRANCH_1
PARENT=COMPLEX_JOB
==========================================================
============= Input parameters =============
CONDITION_SWITCH=COMPLEX
ACTION_SWITCH=CANCEL
CONDITION_COUNT=3
PATTERN[1]=Error
IS_CASE_SENSITIVE[1]=YES
IS_REGULAR_EXPRESSION[1]=NO
NEGATE_CONDITION_RESULT[1]=YES
PATTERN[2]=Free space on Primary device
IS_CASE_SENSITIVE[1]=YES
IS_REGULAR_EXPRESSION[1]=NO
VALUE[2]=50
ARITHMETICAL_OPERATOR[2]=-gt
BOOLEAN OPERATOR[2]=&&
NEGATE_CONDITION_RESULT[2]=NO
PATTERN[3]=Free space on Secondary device
IS_CASE_SENSITIVE[1]=YES
IS_REGULAR_EXPRESSION[1]=NO
VALUE[3]=60
ARITHMETICAL_OPERATOR[3]=-gt
BOOLEAN OPERATOR[3]=||
NEGATE_CONDITION_RESULT[3]=NO
==========================================================
============= MAIN DECISION MAKING =============
COMPLEX condition evaluation
----------ATOMIC CONDITION 1------------
Searching for "Error" in JOBLOG of COMPLEX_JOB
Pattern NOT FOUND, condition evaluated as FALSE.
==NEGATED== ATOMIC CONDITION RESULT [1]= TRUE
----------ATOMIC CONDITION 2------------
Searching for "Free space on Primary device" in JOBLOG of COMPLEX_JOB
Pattern FOUND, performing further tests.
Searching for NUMBER withing row...
Number found=55. Evaluating arithmetical expression [ 55 -gt 50 ]
Arithmetical expression [ 55 -gt 50 ] evaluated as TRUE.
ATOMIC CONDITION RESULT [2]= TRUE
----------ATOMIC CONDITION 3------------
Searching for "Free space on Secondary device" in JOBLOG of COMPLEX_JOB
Pattern FOUND, performing further tests.
Searching for NUMBER withing row...
Number found=10. Evaluating arithmetical expression [ 10 -gt 60 ]
Arithmetical expression [ 10 -gt 60 ] evaluated as FALSE.
ATOMIC CONDITION RESULT [3]= FALSE
-------------------------------------
-------- COMPLEX CONDITION ----------
[ TRUE ] && [ TRUE ] || [ FALSE ]
CONDITION_RESULT=TRUE
TRUE: The result of complex condition is TRUE.
==========================================================
============= Action on STOP Branch =============
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEEW.B_DO_THE_BAD_THING
%cj SYDNEY#0AAAAAAAAAAAAEEW.B_DO_THE_BAD_THING;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_COMPLEX[(2219 12/17/07)
(0AAAAAAAAAAAAEEW)].B_DO_THE_BAD_THING
==========================================================
============= Action on RUN Branch =============
Performing action RELEASE on job SYDNEY#0AAAAAAAAAAAAEEW.G_DO_THE_GOOD_THING
Releasing of job SYDNEY#0AAAAAAAAAAAAEEW.G_DO_THE_GOOD_THING is NOT NECESSARY,
because priority=10
==========================================================
============= Statistics of branch job BRANCH_1 =============
TRUE: The result of complex condition is TRUE.
For action CANCEL - RUN_BRANCH=G_DO_THE_GOOD_THING and 
STOP_BRANCH=B_DO_THE_BAD_THING
BRANCH selected to STOP: B_DO_THE_BAD_THING
BRANCH selected to CONTINUE: G_DO_THE_GOOD_THING
CANCELED_JOBS: B_DO_THE_BAD_THING
PAUSED_JOB:
RELEASED_JOB:
============ END of branch job BRANCH_1 ==========

Required input parameters

Table 1 shows the parameters required for the complex condition scenario.

Table 1. Input parameters for the complex condition scenario
Parameter name Parameter value
CONDITION_SWITCH COMPLEX
PATTERN_1 Error
NEGATE_CONDITION_RESULT_1 YES
PATTERN_2 Free space on Primary device
VALUE_2 50
ARITHMETICAL_OPERATOR_2 -gt
BOOLEAN OPERATOR_2 &&
PATTERN_3 Free space on Secondary device
VALUE_3 60
ARITHMETICAL_OPERATOR_3 -gt
BOOLEAN OPERATOR_3 ||

The following example shows the parameter definition. The text is entered into the Comments field of the job stream definition.

BRANCH_1-BEGIN
CONDITION_SWITCH=COMPLEX
PATTERN_1=Error
NEGATE_CONDITION_RESULT_1=YES
PATTERN_2=Free space on Primary device
VALUE_2=50
ARITHMETICAL_OPERATOR_2=-gt
BOOLEAN_OPERATOR_2=&&
PATTERN_3=Free space on Secondary device
VALUE_3=60
ARITHMETICAL_OPERATOR_3=-gt
BOOLEAN_OPERATOR_3=||
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.

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 of the first branch job within a job stream is BRANCH_1.