Using variables and parameters in job definitions

A variable is a scheduling object that is part of a variable table and is defined in the HCL Workload Automation database. It can be used by all the agents in the domain as long as the users have proper authorization in the security file.

A parameter is defined and used locally on an agent (with the parms utility command).

Variables and parameters have the following uses and limitations in job definitions:
  • Variables and parameters are allowed in the values for the streamlogon, scriptname, docommand, and abendprompt keywords.
  • A variable or parameter can be used as an entire string or as part of it.
  • Multiple variables and parameters are permitted in a single field.
  • Enclose variable names in carets (^), and enclose the entire string in quotation marks. Ensure that caret characters are not preceded by a backslash in the string. If necessary, include the backslash in the definition of the variable or parameter.
  • Enclose parameter names in single quotes (') in UNIX, and enclose the entire string in quotation marks.
In the following example a variable named mis is used in the streamlogon value:
$jobs
cpu1#bkup
     scriptname "/usr/mis/scripts/bkup"
     streamlogon "^mis^"
     recovery continue after recjob1 
For additional examples, see Variable and parameter definition.

For information about how to pass variables between jobs in the same job stream instance, see Passing variables between jobs.

Nested variables for increased flexibility

You can define one or more variables whose value contains another variable to allow dynamic variable substitution at run time. This feature makes your definitions more flexible, maintainable, and reusable.

You can nest any number of variables: the variables are resolved at run time in a recursive pattern, until they are all resolved. If a variable is not set, it is ignored and HCL Workload Automation proceeds to the next variable, until the resolution process is completed.

For example, you can define the following variables in a variable table:
variable name = JOBCHAIN
variable value = PAYMENT_REPORTS

variable name = POOLNAME
variable value= DDS_${JOBCHAIN}
At run time, the value of the variable named POOLNAME dynamically resolves to DDS_PAYMENT_REPORTS, which is the value of the variable named JOBCHAIN.
Similarly, you can define a variable table with multiple nested and concatenated variables as follows:
VARTABLE TST_VT_1  
MEMBERS  
VAR1 "orig-value"  
VAR2 "VAR2_${VAR1}"  
VAR3 "VAR3_${VAR1}_${VAR2}"  
VAR4 "VAR4_${VAR1}${VAR2}${VAR3}"  
END
The first echo job returns the following output:
var1= orig-value  
var2= VAR2_orig-value  
var3= VAR3_orig-value_VAR2_orig-value  
var4= VAR4_orig-value_VAR2_orig-valueVAR3_orig-value_VAR2_orig-value
If you update VAR1 to 20260219, the output from the second echo job is dynamically resolved with the new value at run time:
var1= 20260219 
var2= VAR2_20260219  
var3= VAR3_20260219_VAR2_20260219  
var4= VAR4_20260219VAR2_20260219VAR3_20260219_VAR2_20260219

Consider a job stream containing a series of nested variables defined in the CITY_ROUTES variable table:

SCHEDULE EU-HWS-LNX104#NESTED_VARIABLES
    VARTABLE CITY_ROUTES
    :
    EU-HWS-LNX104_1#PRINT_ROUTES_JOB
    TASK
    <?xml version="1.0" encoding="UTF-8"?>
    <jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle" 
    xs:text="resolveVariableTable" name="executable">
    <jsdl:application name="executable">
    <jsdle:executable interactive="false">
    <jsdle:script>echo "^VAR5^"
    echo "${VAR9}"</jsdle:script>
    </jsdle:executable>
    </jsdl:application>
    </jsdl:jobDefinition>
    RECOVERY STOP
    
    END

The CITY_ROUTES variable table is as follows:

VARTABLE CITY_ROUTES
    MEMBERS
    VAR1 "Rome"
    VAR2 "${VAR1}, Paris"
    VAR3 "${VAR2}, London"
    VAR4 "${VAR3}, Berlin"
    VAR5 "${VAR4}, Madrid"
    VAR6 "New York"
    VAR7 "${VAR6}, Toronto"
    VAR8 "${VAR7}, Tokyo"
    VAR9 "${VAR8}, Chicago"
    END

The variables are resolved in a recursive pattern until all nested values are substituted. Here is how the specific variables in the job script are resolved based on the syntaxes used:

  • ^VAR5^: Because it is enclosed in caret symbols (^), this variable is resolved when the production plan is generated or extended. It recursively resolves VAR4, VAR3, VAR2, and VAR1, outputting the final concatenated string: Rome, Paris, London, Berlin, Madrid.
  • ${VAR9}: Because it is enclosed using the dollar sign and braces (${}), this variable is dynamically resolved or overwritten when the job is submitted to run. It recursively resolves VAR8, VAR7, and VAR6, outputting the final concatenated string: New York, Toronto, Tokyo, Chicago. This resolution mode requires you set the Variable resolution at runtime property in the integration.

This example successfully follows the necessary syntax rules for nested variables:

  • Inside the variable table (CITY_ROUTES): The definitions correctly use the ${variablename} syntax to nest other variables (for example, "${VAR1}, Paris"). You must use this syntax because the caret symbol (^) is not supported when defining nested variables within a variable table.
  • Inside the job definition (PRINT_ROUTES_JOB): Both the caret symbol (^) and the ${variablename} syntax are fully supported when referencing those nested variables inside the script of an integration.

The job stream with the resolved variables looks as follows:

SCHEDULE EU-HWS-LNX104#NESTED_VARIABLES
    VARTABLE CITY_ROUTES
    :
    EU-HWS-LNX104_1#PRINT_ROUTES_JOB
    TASK
    <?xml version="1.0" encoding="UTF-8"?>
    <jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" 
    xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle" 
    xs:text="resolveVariableTable" name="executable">
    <jsdl:application name="executable">
    <jsdle:executable interactive="false">
    <jsdle:script>echo "Rome, Paris, London, Berlin, Madrid"
    echo "New York, Toronto, Tokyo, Chicago"</jsdle:script>
    </jsdle:executable>
    </jsdl:application>
    </jsdl:jobDefinition>
    RECOVERY STOP
    
    END

In this resolved version, ^VAR5^ has been fully recursively resolved and replaced with Rome, Paris, London, Berlin, Madrid, and ${VAR9} has been dynamically resolved and replaced with New York, Toronto, Tokyo, Chicago based on the hierarchy defined in the CITY_ROUTES variable table.

Note: The following limitations apply:
  • This functionality is supported only for integrations running on dynamic agents. It is not supported on native job types.
  • The caret symbol (^) is not supported if you define the variable within a variable table. When defining nested variables within a variable table, you must use the ${variablename} syntax. However, both the caret symbol (^) and the ${variablename} syntax are supported when you reference the variable in the job definition of an integration running on a dynamic agent.