HCL Workload Automation, Version 9.4

Complex branch - Numeric value comparison

To combine pattern searching with the numeric value comparison.

Pattern within pattern row branch usage

This scenario extends the function of the pattern scenario described in Complex branch - Pattern. The purpose of this scenario is to:

  1. Get the parent job log.
  2. Within the job log, identify the row containing a specific pattern.
  3. If the row is found, search for a numeric value within it.
  4. Compare the number against the number that is supplied as input parameter, by using the arithmetical operator that is also supplied as a parameter.

The following extract from the parent job log shows a typical usage scenario:

Checking free space...
Free space on volume ABC is 50 %.

You want to perform the following evaluation:

  1. Search for the pattern Free space on volume.
  2. If the text is found, try to extract a numeric value.
  3. Compare the numeric value as follows:
    If (numeric_value > 30)
    Then CONDITION=TRUE
    Else CONDITION=FALSE

The number 30 and operator > are parameters passed to the branch job. You can use any arithmetical operators (for example, <, <=, >). For a description about how to specify the parameters for the branch job, see Specifying the branch job parameters.

Figure 1 shows the definition for the numeric value comparison scenario. You can also invert the evaluation logic, although normally this is not required because you can reach the negated condition result by using the opposite operator.

Figure 1. Numeric comparison branch definitionDefinition of a job stream searching for a pattern, then a numeric value within the pattern row, then comparing that value with the value that you specified.

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_PATTERN_NUM
STREAM_CPU=SYDNEY
BRANCH_JOB_NAME=BRANCH_1
PARENT=PATTERN_NUMBER_JOB
==========================================================
============= Input parameters =============
CONDITION_SWITCH=COMPLEX
ACTION_SWITCH=CANCEL
CONDITION_COUNT=1
PATTERN[1]=Free space on volume
IS_CASE_SENSITIVE[1]=YES
IS_REGULAR_EXPRESSION[1]=NO
VALUE[1]=30
ARITHMETICAL_OPERATOR[1]=-gt
NEGATE_CONDITION_RESULT[1]=NO
==========================================================
============= MAIN DECISION MAKING =============
COMPLEX condition evaluation
----------ATOMIC CONDITION 1------------
Searching for "Free space on volume" in JOBLOG of PATTERN_NUMBER_JOB
Pattern FOUND, performing further tests.
Searching for NUMBER withing row...
Number found=50. Evaluating arithmetical expression [ 50 -gt 30 ]
Arithmetical expression [ 50 -gt 30 ] evaluated as TRUE.
ATOMIC CONDITION RESULT [1]= TRUE
-------------------------------------
-------- COMPLEX CONDITION ----------
[ TRUE ]
CONDITION_RESULT=TRUE
TRUE: The result of complex condition is TRUE.
==========================================================
============= Action on STOP Branch =============
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAEET.B_DO_THE_BAD_THING
%cj SYDNEY#0AAAAAAAAAAAAEET.B_DO_THE_BAD_THING;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_PATTERN_NUM[(2113 12/17/07),
(0AAAAAAAAAAAAEET)].B_DO_THE_BAD_THING
==========================================================
============= Action on RUN Branch =============
Performing action RELEASE on job SYDNEY#0AAAAAAAAAAAAEET.G_DO_THE_GOOD_THING
Releasing of job SYDNEY#0AAAAAAAAAAAAEET.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 pattern within pattern row scenario.

Table 1. Input parameters for the Numeric comparison scenario
Parameter name Parameter value
CONDITION_SWITCH COMPLEX
PATTERN_1 Free space on volume
VALUE_1 30
ARITHMETICAL_OPERATOR -gt
It is important to understand the order used to pass the numbers to the arithmetical expression:
number_from_the_joblog compared_against number_supplied_as_parameter
compared_against is the arithmetical operator specified as parameter. If you do not specify an operator, the default value -eq (equals) is used.

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=Free space on volume
VALUE_1=30
ARITHMETICAL_OPERATOR_1=-gt
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 so 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.