HCL Workload Automation, Version 9.4

Complex branch - Pattern within pattern row

This scenario extends the function of the pattern searching.

Pattern within pattern row scenario usage

The purpose of this scenario is to:

  1. Get the parent job log.
  2. In the job log, identify a row containing a specific pattern.
  3. If the row is found, search for another pattern within the row.
  4. If the second pattern is found, return the condition as TRUE.

The following example extracted from a parent job log shows what a typical usage scenario looks like:

Sending STOP signal to component XYZ: SUCCESS
Stopping component XYZ: SUCCESS

Based on this example, a simple search for the text pattern SUCCESS would not show that the component had really stopped. There are multiple occurrences of pattern SUCCESS and by using the simple pattern search you would not determine the correct result.

Another example might be the following job log extract:

About to stop component XYZ...
Sending STOP signal to component XYZ: SUCCESS
Stopping component XYZ: FAILED

Based on this example, if you used the simple pattern search the result is CONDITION=TRUE, because the pattern SUCCESS is found. But in this case, the parent job log is not evaluated correctly.

To correctly evaluate the parent job log, you must use the pattern within pattern row scenario, as follows:

  1. Search for the pattern Stopping component.
  2. If the row is found, search for the pattern SUCCESS.
  3. If both searches are successful, then return the condition as TRUE.

Figure 1 shows the definition for the pattern branch scenario.

Figure 1. Pattern within pattern row definitionDefinition of a job stream searching for a pattern, then another pattern in the same row, when you hope that the search is not successful.

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_PATT
STREAM_CPU=SYDNEY
BRANCH_JOB_NAME=BRANCH_1
PARENT=PATTERN_PATTERN_JOB
==========================================================
============= Input parameters =============
CONDITION_SWITCH=COMPLEX
ACTION_SWITCH=CANCEL
CONDITION_COUNT=1
PATTERN[1]=Stopping component
VALUE[1]=SUCCESS
IS_CASE_SENSITIVE[1]=YES
IS_REGULAR_EXPRESSION[1]=NO
NEGATE_CONDITION_RESULT[1]=NO
==========================================================
============= MAIN DECISION MAKING =============
COMPLEX condition evaluation
----------ATOMIC CONDITION 1------------
Searching for "Stopping component" in JOBLOG of PATTERN_PATTERN_JOB
Pattern FOUND, performing further tests.
Searching for STRING=SUCCESS within the 
   row "Stopping component XYZ: FAILED".
String "SUCCESS" NOT found within the 
   row "Stopping component XYZ: FAILED".
ATOMIC CONDITION RESULT [1]= FALSE
-------------------------------------
-------- COMPLEX CONDITION ----------
[ FALSE ]
CONDITION_RESULT=FALSE
FALSE: The result of complex condition is FALSE.
==========================================================
============= Action on STOP Branch =============
Performing action CANCEL on job SYDNEY#0AAAAAAAAAAAAED2.G_DO_THE_GOOD_THING
%cj SYDNEY#0AAAAAAAAAAAAED2.G_DO_THE_GOOD_THING;schedid;noask
Command forwarded to batchman for SYDNEY#GBJ_PATTERN_PATT[(1634 12/17/07),
   (0AAAAAAAAAAAAED2)].G_DO_THE_GOOD_THING
==========================================================
============= Action on RUN Branch =============
Performing action RELEASE on job SYDNEY#0AAAAAAAAAAAAED2.B_DO_THE_BAD_THING
Releasing of job SYDNEY#0AAAAAAAAAAAAED2.B_DO_THE_BAD_THING is NOT NECESSARY,
   because priority=10
==========================================================
============= Statistics of branch job BRANCH_1 =============
FALSE: The result of complex condition is FALSE.
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
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 pattern within pattern row scenario
Parameter name Parameter value
CONDITION_SWITCH COMPLEX
PATTERN_1 Stopping component
VALUE_1 SUCCESS

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

BRANCH_1-BEGIN
CONDITION_SWITCH=COMPLEX
PATTERN_1=Stopping component
VALUE_1=SUCCESS
BRANCH_1-END

For details about how to specify the branch job parameters, see Specifying the branch job parameters.

Placing the branch job into the job stream

Put the generic branch job into the job stream just 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.