Using HCL Workload Automation conditional dependencies feature it’s very easy to solve this design problem, by reading this blog you will learn how to create and use conditional dependencies in many use cases.
It’s a job dependency that will be released in case a particular status is reached or a specific output condition is verified on the parent job. If the condition is not satisfied, the dependent job will be suppressed.
Thinking about conditional dependency on job status we can affirm that is a generalization of the standard dependency that is released if the parent job ends in success or it’s canceled while, on conditional dependency, you can map any status as requirement even an ABEND or RUNNING state and, if not satisfied upon parent job’s completion, the child job will go into SUPPRESS state instead of remaining in HOLD status like in standard dependencies.
Let’s see our first use case.
As you can see in the figure if PRINT_ANSWER job is successful the MANAGE_ERROR job will be suppressed and the regular PROCESS_DATA job will run.
Sometimes it’s required to manage the job stream flow differently depending on a job’s return code instead of its status. Let’s see this use case in details.
Use case 2: branching by return code
Job START has two different successful output conditions labeled as “zero” and “four” and jobs CHILD_0 and CHILD_4 are dependent from it with a conditional dependency based on the respective output conditions.
In the example the exit code of START is 4 and condition “four” is true while condition “zero” is false causing job CHILD_0 suppressing and job CHILD_4 executing.
Let’s make the processing requirement more complex like branching the workflow basing on the content of the job log or the result of a database query or a particular value of a JSON received as answer in a RESTful job and not on the status mapped for the job…
Imagine now that two different branches are not enough for your requirements, but you need to implement multiple branches like in the next use case…
Ok, we learnt how to branch the flow in a job stream, is it possible to join the branches? Yes, it is explained in the next use case.
We are at the end of our journey into logical branching for job streams but before leaving remember that if you need to add a sequence of more than one job in each branch you need to concatenate the parent-child jobs with a conditional dependency activated by the SUCC state of the parent job. You really need this trick because the first job of a chain in a branch that is not pursued will be suppressed and the default behavior in classical dependency definition is to release the child job for execution so, the second step of the chain will start to execute while your desired result is to have the entire branch pipeline suppressed! Forcing the dependency to be released only in presence of a SUCC state of the parent job will cause a cascade suppression of the jobs in your branch as desired.
Happy conditional logic designing!
AuthorRiccardo Pizzutilo is a Presales Technical Specialist for Workload Automation at HCL Riccardo has joined the Workload Automation family since 2005 at the IBM Rome Tivoli lab as QA engineer when the version 8.3 was under development. After thousands of defects found (and fixed) he joined the L3 team and then moved to HCL in a presale’s role, guiding customers from all over the world into their continuous transformation. This is not Riccardo’s first ASAP conference; he enjoyed the ASAP atmosphere even in 2014. |