Coding variables in JCL

A variable, either user-defined or supplied by HCL Workload Automation for Z, consists of up to 8 alphanumeric characters, the first of which must be alphabetic. When using a variable in a job, precede it with an ampersand (&), a percent sign (%), or a question mark (?). The symbol preceding the variable determines how HCL Workload Automation for Z carries out the variable substitution. A period can denote the end of a variable name. You can use a variable repeatedly within the job using different prefix symbols.

Table 1. Symbols that mark the end of variables
Symbol Description
, Comma
/ Forward slash
' Single quotation mark
( Left parenthesis
) Right parenthesis
* Asterisk
& Ampersand
&& Double ampersand
% Percent sign
+ Plus sign
- Dash
= Equals sign
  Blank ( )
Blank
? Question mark

To maintain compatibility with variable substitution within z/OS® JCL procedures, HCL Workload Automation for Z will assume that a variable has ended (even if the completing period is missing) if the variable is followed by one of the symbols listed in Symbols that mark the end of variables. An ampersand or percent variable can be assigned a value that is itself a variable.

For example, if LIBRARY is given the value LINKLIB for the following statement:

//STEPLIB DD DSN=MY.&LIBRARY.(IEFBR14),DISP=SHR

or the following statement (without the completing period):

//STEPLIB DD DSN=MY.&LIBRARY(IEFBR14),DISP=SHR

The JCL line becomes as follows:

//STEPLIB DD DSN=MY.LINKLIB(IEFBR14),DISP=SHR

The product assumes that the variable LIBRARY ends when it detects the left parenthesis '('.

Note: The completing period is discarded when a variable is substituted. Other termination symbols are left in place.
Note: When coding JCL, do not insert all the messages that HCL Workload Automation for Z uses during the variable substitution process (that is, VARIABLE SUBSTITUTION FAILED with OPCSMSG at column 73).