Passing job properties from one job to another in the same job stream instance
Export job properties, such as job status, integration type, and rerun counter, from one dynamic job to a successor job in the same job stream instance.
The job properties that you can export from one dynamic job to a successor job in
the same job stream instance depend on the job type you are defining. To add a job property
within a successor job definition so that it is resolved locally on the agent at run time, use
the following
syntax:
${job:<JOB_NAME>.<property_name>}where
<JOB_NAME> is the name value or alias name value of the job from which
you are exporting the property values and <property_name> is the property
that you are referring to. The <property_name> value is case
insensitive.Additionally, you can use this syntax to retrieve specific cross-job metadata
by using the following property names:
- Job status
- Retrieve the status of a job belonging to the same job stream (in the
format returned by the dynamic domain manager) by specifying
.statusas the property name:${job:<JOB_NAME>.status}. - Integration type
- Retrieve the integration type of a job belonging to the same job stream by
specifying
.nameas the property name:${job:<JOB_NAME>.name}. Note that this property returns the specific integration type of the referenced job (for example,executable), and not the actual name of the job. - Rerun counter
- Pass the deterministic rerun counter of a job to a successor job by
referencing the
${job:<JOB_NAME>.reruncount}property. This allows your downstream jobs and diagnostics to instantly determine how many times the predecessor job was rerun and dynamically adapt their script logic accordingly.
Consider the following scenario:
- You create a job stream containing jobs J1 and J2, where J2 is scheduled to run after J1.
- J1 finishes and reaches its final state. From within J2, you want to know the status of J1 at runtime.
- You use the syntax ${job:J1.status} inside J2, and it returns the final state of J1 in the dynamic domain manager format (for example, if it finished successfully, it displays SUCCEEDED_EXECUTION).
- Similarly, if J1 is an executable job and you want to retrieve its integration type at run time, you use the syntax ${job:J1.name} inside J2, and it returns executable.
Note: You cannot use the following keywords as
<property_name> variables:
- RC
- returncode
- name
- status
- stdlist
- stduri
If you use these keywords to define custom output properties, they are not resolved and
valued as expected by subsequent jobs. For example, if you specify
${job:PREVIOUSJOB.name}, the successor job fails to resolve the
variable.
Only some job types can pass property values
to other successor jobs. The following types of job can export variables:
- Shadow jobs
- Properties
for shadow jobs shows the list
of properties that you can pass from one shadow job to another and
indicates the mapping between the
Extra informationproperties of the job and the properties that you can use. - IBM Sterling Connect:Direct jobs
- Properties for IBM Sterling Connect:Direct jobs shows the list
of properties that you can pass from one IBM Sterling Connect:Direct job
to another and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use. - File transfer jobs
- Properties
for file transfer jobs shows
the list of properties that you can pass from one file transfer job
to another and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use.Since you can use wildcards to specify a partial name condition, you can transfer more than one file within the same job, and you have one full set of properties for each transferred file.
- JSR 352 Java Batch jobs
- Properties for JSR 352 Java Batch jobs shows the list of properties that you can
pass from one JSR 352 Java Batch job
to another and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use. - Job Management jobs
- Properties for Job Management
jobs shows the list of properties that you can
pass from one Job Management job to another
and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use. - Job Stream Submission jobs
- Properties for Job Stream Submission jobs shows the list of properties that you
can pass from one Job Stream Submission job to another and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use. - Database jobs
- Properties for database jobs shows the list of properties that you can pass
from one database job to another and indicates the mapping between the
Extra informationproperties of the job and the properties that you can use.
The following example demonstrates how specifying variables in different formats allows for
variables to have different values because they are resolved at different times. It also
demonstrates how variables can be passed from job to job in a job stream instance. The
WIN92MAS_REW#VP_JS_141800058 job stream contains JOBA
and JOBB jobs. The JOBB executable job references the
following properties of the JOBA shadow job:
- ScheduledTime
- dJobNAme
- dJobStreamName
- dJobStreamWorkstation
SCHEDULE WIN92MAS_REW#VP_JS_141800058
:
WIN92MAS_REW#JOBA
TASK
<?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition xmlns:dshadow=
"http://www.ibm.com/xmlns/prod/scheduling/1.0/dshadow" xmlns:
jsdl="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdl">
<jsdl:application name="distributedShadowJob">
<dshadow:DistributedShadowJob>
<dshadow:JobStream>VPJS_141800058</dshadow:JobStream>
<dshadow:Workstation>nc125133</dshadow:Workstation>
<dshadow:Job>VP_JOBMON_141800058</dshadow:Job>
<dshadow:matching>
<dshadow:previous/>
</dshadow:matching>
</dshadow:DistributedShadowJob>
</jsdl:application>
</jsdl:jobDefinition>
DESCRIPTION "Sample Job Definition for DISTRIBUTED environment"
RECOVERY STOP
NC125133#JOBB
TASK
<?xml version="1.0" encoding="UTF-8"?>
<jsdl:jobDefinition xmlns:XMLSchema=
"http://www.w3.org/2001/XMLSchema" xmlns:jsdl="http://www.ibm.com/xmlns/
prod/scheduling/1.0/jsdl" xmlns:
jsdle="http://www.ibm.com/xmlns/prod/scheduling/1.0/jsdle"
XMLSchema:text="resolveVariableTable" name="executable">
<jsdl:application name="executable">
<jsdle:executable>
<jsdle:script>
echo ScheduledTime:${job:JOBA.ScheduledTime}
echo JobName:${job:JOBA.dJobName}
echo JobStreamName:${job:JOBA.dJobStreamName}
echo JobStreamWorkstation:${job:JOBA.dJobStreamWorkstation}
</jsdle:script>
</jsdle:executable>
</jsdl:application>
</jsdl:jobDefinition>
DESCRIPTION "Added by composer."
RECOVERY STOP
FOLLOWS JOBA
END| Shadow job properties that can be passed to another job definition | Shadow job Extra Information properties |
|---|---|
|
|
|
|
|
|
|
|
| IBM Sterling Connect:Direct properties that can be passed to another job definition | IBM Sterling Connect:Direct job Extra Information properties |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| File Transfer properties that can be passed to another job definition | File Transfer job Extra Information properties |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Only one value for each job. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Only one value for each job. |
|
|
|
|
| JSR 352 Java Batch job properties that can be passed to another job | Label |
|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| The following variables are exported for each step of the job: | |
|
|
|
|
| Job Management job properties that can be passed to another job | Label |
|---|---|
| ${job:<JOB_NAME>. jobName} | jobname |
| ${job:<JOB_NAME>. jobstreamId} | jobstreamid |
| ${job:<JOB_NAME>.workstation} | workstation |
| ${job:<JOB_NAME>.user} | userName |
| ${job:<JOB_NAME>.url} | Url |
| Job Stream Submission job properties that can be passed to another job | Label |
|---|---|
| ${job:<JOB_NAME>.Url} | Url |
| ${job:<JOB_NAME>.workstation} | Workstation |
| ${job:<JOB_NAME>. jobstreamname} | Job Stream Name |
| ${job:<JOB_NAME>.datetime} | Earliest Start DateTime |
| ${job:<JOB_NAME>.variabletablename} | Variable Table Name |
| ${job:<JOB_NAME>.variablelistValues} | Variable Table Values {"key1":value1,"key2":value2,...} |
| Database job properties that can be passed to another job | Label |
|---|---|
| ${job:<JOB_NAME>.NumberOfRows} | Number of rows |
|
${job:<JOB_NAME>.PPS_ |
The name of the procedure expressed |
|
${job:<JOB_NAME>.PPS_ |
The value of the procedure expressed |