Percent variables

Percent variables can be used to form compound variables and simple variables. Using JCL substitution, you can form compound variables. See Compound variables.

The values of the percent variables making up a compound variable are not substituted directly. Instead, these values are used to form new variables, which have their own values assigned. HCL Workload Automation for Z attempts to resolve such variables in a series of passes. The individual variables making up the compound variable are resolved, moving from right to left.

For example, consider the following line of JCL from a job:
//STEPLIB DD DSN=MY.&DATA%SET,DISP=OLD

Assume that SET has been given a value of LIB. After the first pass, the variable DATA%SET becomes variable DATALIB because the right-most percent variable is resolved on the first pass. This first pass has now formed a new variable, DATALIB, which HCL Workload Automation for Z will try to resolve on its next pass across this line of JCL.

The new variable DATALIB is treated the same as any other JCL variable. That is, it must be predefined in a variable table and have a value assigned to it. The value can be assigned automatically by HCL Workload Automation for Z, a substitution exit, or manually, using the panels.

Compound variables can be made up of a sequence of many %-variables. Consider the following line:
//DDNAME1 DD DSN=MY.%VAR1%VAR2%VAR3....DATA,DISP=OLD
Assume that VAR3 has value SIX and VAR2SIX has value JUNE. On the first pass over this line of JCL, the variable %VAR1%VAR2%VAR3....DATA becomes %VAR1%VAR2SIX...DATA. On the second pass, the variable %VAR1%VAR2SIX. becomes %VAR1JUNE..DATA. The value assigned to %VAR1JUNE. determines the final value that is substituted.

At every substitution, a period was discarded when the variable was substituted. You must specify the correct number of periods to ensure that the substitution is performed correctly. In the preceding example, an extra period was required to denote the beginning of the second-level data set qualifier.

In the next example, you need only one parenthesis to complete the compound variable. This is because the parenthesis is not discarded at substitution.
//DDNAME1 DD DSN=MY.%VAR1%VAR2%VAR3(MEMBER),DISP=OLD

If you specify a compound variable %VAR1%VAR2...DATA, where VAR1 is a promptable variable and VAR2 is a (not promptable) setup variable, the substitution fails, because HCL Workload Automation for Z resolves the compound variable right-to-left.