In Applications Manager, the use of incrementing Substitution Variables (subvar) may be required for various actions to be performed a specified number of times only.
An incrementing subvar is a subvar thas resolves to a number that will increase by one each time the subvar is evaluated. Once it reaches a specified number, another action can be taken.
Some examples scenarios:
Release : 9.4
There are a couple ways to create an incrementing subvar. Both ways, increments a subvar value by one, performs and action such as restarts the Job on Abort, and once it reaches a certain value, another action is taken.
The first method uses 2 subvars, one to sets a value to be incremented and one to increment the first subvar value. Below is an example condition configuration:
The following behavior is expected with this condition configuration:
Condition 1 - set or resets #count_tries value to 0. This is performed only once.
Condition 2 - increments #count_tries by 1
Condition 3 - If #count_tries value is greater than 15, set SKIP status with custom status value "Max Tries". You can change this accordingly.
Condition 4 - Restart on Abort status
As seen below, with this condition set up, a Job Aborts 15 times before skipping with a Max Tries status.
The second method is more simple and parses the JobID, the subvar can be used in multiple Jobs without issue. However since it is using 1 condition, there is less options in what actions can take be taken.
In the below example, the Job restarts 5 times before no longer restarting resulting in the 5th restart staying in Abort status. Here is the condition configuration:
Here is #failcount subvar. Sql for screenshot is select nvl(substr('{jobid}',length(cast ({jobid} as int))+2),0) from dual
Behavior:
Condition 1 - Every time #failcount condition is evaluated, an unseen counter based on the JobID is incremented by 1. Once the counter is no longer less than 5, the condition action of restart Job on Abort no longer occurs and the last instance of the Job stays in Abort status as seen below