Passing variables between flows with ppmsetvar
You can pass variables between flows using ppmsetvar.
The ppmsetvar command
Only available with Process Manager 9.1 and LSF® 9.1 and higher.
You can use the command ppmsetvar from an LSF job, job script, job array and job script array to pass user variables from a subflow to a parent flow, to set user variables that are used only within a flow, or to set global user variables used by all flows in the system. You can also use ppmsetvar to remove specific user variables. You do not need a shared filesystem with ppmsetvar.
To set variables for local jobs, use variable files. You cannot use the command ppmsetvar to set variables for local jobs.
Setting variables that can be used only by work items within a flow
The following example shows how set a user variable that can be used by all work items within a flow using the command ppmsetvar.
This flow contains two subflows to be run as arrays and a condition evaluator that decides whether to run the arrays in parallel or sequentially. The Set_variable job sets the variable MYVAR=1, which indicates to run the array in parallel. This flow also sets the arraysize at the time the flow array runs.
In this example, the job Set_variable sets MYVAR=1 with ppmsetvar.
In the variable evaluator, when MYVAR=1, the job Set_arraysize4 runs. The job Set_arraysize4 sets the variable ARRAYSIZE=4 with ppmsetvar -f.
In the variable evalutor, when MYVAR is equal to any other number, the job Set_arraysize5 runs. The job Set_arraysize5 sets the variable ARRAYSIZE=5 with ppmsetvar -f.
The flow arrays that follow use the variable set by the the jobs Set_arraysize4 or Set_arraysize5 to define how many times the subflows are run as flow arrays.

Passing variables between parent flows and subflows
The following example shows how to pass variables from a parent flow to be used by a subflow, and then how to pass a variable from a subflow to its parent flow using the command ppmsetvar.
This flow contains two dynamic subflows and passes the variable MYVAR=100 to one subflow as an input variable to the flow, and MYVAR=200 to the other subflow as an input variable.
Jobs J1 and J2 write the value passed from the subflow to an output file. The output of J1 is xyz100 and the output of J2 is xyz200.
The last job in
the subflow passes the variable result_#{JS_FLOW_SHORT_NAME}=xyz#{MYVAR}
to the parent flow and also writes the variable to a file. The parent
flow accesses the user variable set by the subflow by indicating the
subflow name such as echo result_Dynamic_Subflow1
and echo
result_Dynamic_Subflow2
.


Setting a global variable that can be used by any flows in the system
The following example shows how to set a user variable that can be used by all flows in the system with the command ppmsetvar.
In the following example, the last job sets the global variable ALLRESULTS to the value 99. This variable can be used by any flow in the system.
