Tivoli Workload Automation, Version 9.1

Variable substitution in z/OS JCL procedures

Variable substitution does not take place within JCL procedures. If you have z/OS® JCL variables within such procedures, their substitution is independent of any substitution made by IBM Tivoli Workload Scheduler for z/OS. Even if the z/OS JCL variable name is the same as an IBM Tivoli Workload Scheduler for z/OS variable name, the values assigned to the two variables will be unrelated. However, if you want the variable reference outside the procedure to be substituted by z/OS, you can define the IBM Tivoli Workload Scheduler for z/OS-variable with the attribute DEF=␢ (value not required). with the attribute DEF=blank (value not required).

If a variable is given a value of ␢ (blank), the If a variable is given a value of blank, the variable will not be substituted if the variable definition states that no value is required. This lets these variables undergo normal JCL substitution after the tailoring performed by IBM Tivoli Workload Scheduler for z/OS. If a variable is given a default value of ¬ (logical not), the variable is deleted from the line.

This means that z/OS substitutes the variables that have a ␢, or not-required, value. IBM Tivoli Workload Scheduler for z/OS substitutes the variables that have values that are not blanks, as well as variables that require values.

This means that MVS™ substitutes the variables that have a blank, or not-required, value. IBM Tivoli Workload Scheduler for z/OS substitutes the variables that have values that are not blanks, as well as variables that require values.

Because procedures are called after IBM Tivoli Workload Scheduler for z/OS substitution has taken place, a situation in which a procedure variable is assigned a IBM Tivoli Workload Scheduler for z/OS variable value can occur. Consider the JCL in Figure 1 and the procedure in Figure 2.

Figure 1. Substituting a variable in a procedure: job JCL
//EXEC    PROC=MYPROC
//DD2     DD DSN=MY.&DS2,DISP=SHR
//EXEC    PROC=MYPROC
//DD2     DD DSN=MY.&DS2,DISP=SHR

If DS2 is defined as a IBM Tivoli Workload Scheduler for z/OS variable, it is substituted in the usual way.

Figure 2. Substituting a variable in a procedure: procedure JCL
//MYPROC   EXEC PGM=IKJEFT01,DYNAMNBR=50,REGION=4096K
//DD2      DD DSN=MY.&DS2,DISP=SHR
//MYPROC   EXEC PGM=IKJEFT01,DYNAMNBR=50,REGION=4096K
//DD2      DD DSN=MY.&DS2,DISP=SHR
If, as in this example, the ddname DD2 occurs in the procedure MYPROC, the entire JCL line will be substituted in the procedure, including the IBM Tivoli Workload Scheduler for z/OS substituted value of DS2:
//DD2     DD DSN=MY.&DS2,DISP=SHR

Any value that the variable DS2 is assigned within the procedure is not substituted in this line because, as far as z/OS is concerned, the variable DS2 does not occur. If you want the variable to take the value assigned by the procedure rather than the IBM Tivoli Workload Scheduler for z/OS value, you can give the variable a default value of ␢ (blank) and set the VALUE REQUIRED attribute to ‘N’ in the IBM Tivoli Workload Scheduler for z/OS database using the JCL VARIABLE DEFINITION panel. This causes IBM Tivoli Workload Scheduler for z/OS to ignore the variable when performing variable substitution.

Note: For inline procedures it is possible to apply variable substitution when VARPROC(YES) has been specified in the OPCOPTS statement.