Passing variables set by using jobprop in one job to another in the same job stream instance
You can use the jobprop utility installed on HCL Workload Automation dynamic agent to set one or more variables and their value in a job and pass it to the successive job in the same job stream instance. This utility is supported only on executable jobs.
To set variable and its value in the first job use the following
syntax:
jobprop <VAR-NAME> <value>
where - <VAR-NAME>
- is the variable that you can export into another job
- <value>
- is the value assigned to the <VAR-NAME>
To define the variables in another job, use the following
syntax:
${jobs.<job_name>.wa.<variable_name>}
where - <job_name>
- is the name or the alias of the job from which you are exporting the <variable_name> value.
In this example, the PAYROLLMAS#JS_PROP job stream contains the
NC125133#JOBA and NC125133#JOBB executable
jobs. The NC125133#JOBB job references the following
NC125133#JOBA variable values set by using the
jobprop utility:
- VAR1 variable set to value1 value.
- VAR2 variable set to value2 value.
- VAR3 variable set to value3 value.
- VAR4 variable set to value4 value.
SCHEDULE PAYROLLMAS#JS_PROP
:
NC125133#JOBA
TASK
<?xml version="1.0" encoding="UTF-8"?>
<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">
<jsdl:application name="executable">
<jsdle:executable interactive="false">
<jsdle:script>#!/bin/sh
. /home/ITAuser/TWA/TWS/tws_env.sh
jobprop VAR1 value1
jobprop VAR2 value2
jobprop VAR3 value3
jobprop VAR4 value4
</jsdle:script>
</jsdle:executable>
</jsdl:application>
</jsdl:jobDefinition>
DESCRIPTION "Sample Job Definition"
RCCONDSUCC "RC>=0"
RECOVERY STOP
NC125133#JOBB
TASK
<?xml version="1.0" encoding="UTF-8"?>
<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">
<jsdl:application name="executable">
<jsdle:executable interactive="false">
<jsdle:script>
echo VAR1=${jobs.JOBA.VAR1}
echo VAR2=${jobs.JOBA.VAR2}
echo VAR3=${jobs.JOBA.VAR3}
echo VAR4=${jobs.JOBA.VAR4}
</jsdle:script>
</jsdle:executable>
</jsdl:application>
</jsdl:jobDefinition>
DESCRIPTION "Sample Job Definition"
RCCONDSUCC "RC>=0"
RECOVERY STOP
FOLLOWS JOBA
END