Passing variables set by jobprop between tasks

You can use the jobprop utility to set one or more variables and their value in a task and pass it to another task. This utility is supported only on executable tasks and is useful for scenarios where tasks need to share or exchange data dynamically after it completes the run.

Overview

Variables can be passed to another task that provides seamless flow of information. To set variable and its value in the first task use the following syntax:
jobprop <VAR-NAME> <value>
For more information about jobprop utility, see Defining variables with the jobprop utility.
To define the variables in another task, use the following syntax:
${jobs.<job_name>.wa.<variable_name>}
job_name
The name or the alias of the task from which you are exporting the <variable_name> value.
variable_name
The name of the variable you want to export.
In this example, the TEST_JS workflow contains the UN123#TASKA and UN123#TASKB executable tasks. The UN123#JOB task references the following UN123#TASKA 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.
---
kind: JobStream
def:
  folder: /
  name: TEST_JS
  jobs:
  - workstation: /UN123
    name: TASKA
    jobDefinitionRef: /UN123#/TASKA
    jobDefinition:
      workstation: /UN123
      type: executable
      task:
        executable:
          interactive: "false"
          script: "#!/bin/sh \n jobprop VAR1 value1 \n jobprop VAR2 value2 \n jobprop VAR3 value3 \n jobprop VAR4 value4"
      recovery:
        action: STOP
  - workstation: /UN123
    name: TASKB
    jobDefinitionRef: /UN123#/TASKB
    jobDefinition:
      workstation: /UN123
      type: executable
      task:
        executable:
          interactive: "false"
          script: |-
            echo VAR1=${jobs.TASKA.VAR1}
            echo VAR2=${jobs.TASKA.VAR2}
            echo VAR3=${jobs.TASKA.VAR3}
            echo VAR4=${jobs.TASKA.VAR4}
      recovery:
        action: STOP
    internalPredecessors:
    - jobName: TASKA