Using variables in HCL Universal Orchestrator jobs

This section explains how to add variables to your jobs.

HCL Universal Orchestrator features a set of predefined variables you can use in your jobs to ensure higher flexibility.

You create a job definition and add one or more of the predefined variables. The variables are assigned a value when the job runs. You can then retrieve this value and use it in a subsequent job in the same job stream. Table Predefined HCL Universal Orchestrator variables lists supported variables.

In addition to these variables, a number of predefined variables is also available in specific job integrations. These variables are exported by default by the job and no user intervention is required to define them. For more information about how you can retrieve the values of these variables for using them in a subsequent job, see Passing properties from one job integration to another job in the same job stream instance.

You can also define custom variables, for executable job types only, as described in Defining variables with the jobprop utility. You can then use these variables in subsequent jobs, as described in Passing variables set by using jobprop in one job to another in the same job stream instance.

The structure of the variable name reproduces the path to the variable in the job context. For example, the jobs.job_name.wa.logon variable is stored in the following path in the example at the end of this topic:
...
 "jobs" : {
    "JOBVAR" : {   
      "wa" : {
        "jobDef" : "/JOBVAR",
        "wksId" : "b4b2068f-0022-4dec-ab01-eb1e48b3b041",
        "logon" : "[wauser]",
...
Table 1. Predefined HCL Universal Orchestrator variables
Variables you can specify in job definitions Description
jobs.job_name.wa.actualStart Date of the submitted job.
jobs.job_name.wa.key Fully qualified name of the job (UNISON_JOB)
jobs.job_name.wa.start Input arrival time of the job
jobs.job_name.wa.logon Credentials of the user who runs the job (LOGIN). Applies only to backward-compatible jobs.
jobs.job_name.wa.name Name of the submitted job
jobs.job_name.wa.runid UNISON_JOBNUM
jobs.job_name.wa.wks Name of the workstation on which the job is defined
js.id ID of the job stream that includes the job (UNISON_SCHED_ID)
js.name Name of the job stream that includes the job (UNISON_SCHED)
js.wks Name of the workstation on which the job stream that includes the job is defined.
To refer to a variable in the current job, you can replace the jobs.job_name notation listed in Predefined HCL Universal Orchestrator variables with a shorter notation, as follows:
$this().wa.variable_name
When defining in a subsequent job a variable to be retrieved from a previous job, use the following notation:
${jobs.job_name.wa.variable_name}
The following example illustrates a job stream named JSVAR containing two jobs (JOBVAR and JOBVAR2) in which JOBVAR2 retrieves the value of some variables defined in JOBVAR. When JOBVAR runs, the variables it contains are assigned a value and this value is then used by the JOBVAR2 job:
SCHEDULE WS_AGT_0#JSVAR 
:
WS_AGT_0#JOBVAR
 TASK
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:
jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle" name="executable">
    <jsdl:application name="executable">
        <jsdle:executable interactive="false">
            <jsdle:script>echo 'name: ${$this().wa.name}'
echo 'wks: ${$this().wa.wks}'
echo 'js.name: ${js.name}'
echo 'js.wks: ${js.wks}'</jsdle:script>
            <jsdle:credential>
                <jsdle:userName>wauser</jsdle:userName>
                <jsdle:password>${password:}</jsdle:password>
            </jsdle:credential>
        </jsdle:executable>
    </jsdl:application>
</jsdl:jobDefinition>
 RECOVERY STOP


WS_AGT_1#JOBVAR2
 TASK
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jsdl:jobDefinition xmlns:jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl" xmlns:
jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle" name="executable">
    <jsdl:application name="executable">
        <jsdle:executable interactive="false">
            <jsdle:script>echo 'logon: ${jobs.JOBVAR.wa.logon}'</jsdle:script>
            <jsdle:credential>
                <jsdle:userName>wauser</jsdle:userName>
                <jsdle:password>${password:}</jsdle:password>
            </jsdle:credential>
        </jsdle:executable>
    </jsdl:application>
</jsdl:jobDefinition>
 RECOVERY STOP
 FOLLOWS JOBVAR 

END
The resulting job context is as follows:
{JSVAR 

  "_this" : "jobs.JOBVAR", 

  "js" : { 

    "defId" : "4c05f44c-937f-4ad0-b7b5-1b09be647e38", 

    "wksId" : "b4b2068f-0022-4dec-ab01-eb1e48b3b041", 

    "name" : "/JSVAR", 

    "schedTime" : "2023-02-15T11:00:10.823Z", 

    "id" : "60bd2dcd-4d85-479f-901e-f8fffed18607", 

    "wks" : "/WS_AGT_0" 

  }, 

  "jobs" : { 

    "JOBVAR" : { 

      "wa" : { 

        "jobDef" : "/JOBVAR", 

        "wksId" : "b4b2068f-0022-4dec-ab01-eb1e48b3b041", 

        "logon" : "[wauser]", 

        "name" : "JOBVAR", 

        "rerunNum" : 0, 

        "id" : "c8dba305-90fd-4950-965f-efc5f07db2c8", 

        "jobDefId" : "deab69a4-e2d4-405f-853b-9bf9e08f1f65", 

        "wks" : "/WS_AGT_0" 

      } 

    }, 

    "JOBVAR2" : { 

      "wa" : { 

        "jobDef" : "/JOBVAR2", 

        "wksId" : "f0e04e03-aa27-4b20-9f5e-40eb5bf66b82", 

        "logon" : "[wauser]", 

        "name" : "JOBVAR2", 

        "rerunNum" : 0, 

        "id" : "44439148-be6e-41cd-bc84-f0093e47e481", 

        "jobDefId" : "3daae93c-6279-4af9-91cd-ae2a1807f306", 

        "wks" : "/WS_AGT_1" 

      } 

    } 

  } 

}