Updating and Passing Variables Runtime
ActiveBatch provides the ability for a Job to pass input parameters and/or variables (and their values) to downstream Jobs. A downstream Job is one that will be triggered via a
. A Job can also update a Plan variable. There are (2) methods provided for variable passing and Plan variable updates: Jobs Library Job Steps and Command-Line.
Job Steps
The ActiveBatch Set Variable or Set Variables Job steps allows you to set one or more variables whose purpose is to allow the passage of information within a workflow. Note: The only difference between Set Variable and Set Variables is you can set more than one variable using the Set Variables step, reducing the amount of steps in your workflow.
The example above passes data from the execution variable named StrData to a variable named SetOfFiles. The data in the execution variable value could have been a hardcoded string, the return value of an upstream Job step, or any data accepted by ActiveBatch.
Assume, using the example above, that the SetVariable step is configured on JobA. When JobA triggers JobB using a completion trigger, JobB is automatically passed the variable named SetOfFiles. JobB can reference the passed variable using the standard syntax: ${SetOfFiles} in any property that supports variable substitution. For example, ${SetOfFiles} could be JobB's input parameter, when using a Process or Script type Job.
In addition to passing a variable to downstream Job on a completion trigger, the SetVariable and SetVariables steps can update a Plan's variable(s), using this sample syntax in the VariableName property: ../SetOfFiles. It is the ../ syntax that indicates a Plan variable will be updated. All downstream Jobs (not steps) that follow this Job, can access the updated variable value when they reference ${SetOfFiles} in Job properties that support variable substitution.
Command-Line
The ActiveBatch utility named Abatset is a command-line based utility program that is used by a Job, at run-time, to modify Plan variables and/or to pass input parameters and/or Job variable(s) (and their value(s)) to downstream Jobs. The abatset command can only be issued within an ActiveBatch created Job. The abatset command can be used in a script or process Job type, as well as some Jobs Library Job steps, which includes: EmbeddedScript, ShellCommand and ExecutePowerShellScript step. It is a bit more feature-rich than the above-described Set Variable steps.
Note: This section does not cover all the details associated with abatset. For a completion description of this command-line utility see Command Line Utilities.
For example, the command:
abatset /success /failure /param 123
would pass the value “123” as an input parameter to the downstream Job(s) that the current Job triggers via the completion trigger feature.
This next command would modify a Plan's variable runtime:
abatset /env ../plan1=abc
The above syntax will modify the Plan variable named “plan1” and change its value to “abc”. The ../ syntax is used to indicate that a Plan variable is being updated. Plan variables are set immediately (any qualifiers are ignored with reference to the variable).
To pass the current Job parameters and variables to the next downstream Job(s) you could use this command:
abatset /current
To pass a Job variable, use this syntax:
abatset /success /env test1=abc test2=efg
This example will pass two (2) variables, test1 and test2 (and their assigned values), to the following downstream Job(s).
ActiveBatch uses a “Replace or Insert” model when performing these actions (for both abatset and the Set Variable Job steps). If the variable exists, the new value replaces the existing one. If the variable doesn’t exist, the entire variable and its value are added to the downstream Jobs.
Note: The replace or insert is performed during runtime only, on the instances. Object definitions are not modified (using abatset or set variables). That is, existing variables set on the object definition do not have their values replaced, and new variables are not added to the object definition. When a Job/Plan instance completes, you can examine the instance (variable) history to see the variable values that a Job or Plan used.
To avoid operating system ambiguity with regard to embedded spaces, you should follow your operating system recommendations. For example, with Windows you would enclose the entire parameter or variable specification within the set of quotation marks. For example:
abatset /success /env “workdir=c:\program files\asci\activebatch”
This avoids the mistake of ActiveBatch thinking that multiple variables are being passed.