Previous topic |
Next topic |
Contact z/OS |
Defining and nullifying JCL symbols
z/OS MVS JCL Reference
When you code JCL symbols, you must define or nullify them in your JCL each time a job runs; otherwise, the system does not substitute text for JCL symbols.
The maximum length of any substitution text that you can assign to a JCL symbol is 255 characters.
To define or nullify a JCL symbol, code the substitution text on one or more of the following:
If the SET statement defines a value for a JCL symbol but that symbol is not coded in the JCL, there is no JCL error. Otherwise:
Syntax of JCL symbol definitions: To define a substitution text to a JCL symbol, code:
Rules for defining JCL symbols:
Defining names for JCL symbols: IBM recommends that your installation define standard names for frequently used JCL symbols and enforce the use of those names. For example, if your installation frequently assigns department numbers in procedures, define the &DEPT JCL symbol and use it consistently. If your installation plans to provide a standard set of JCL symbols, ensure that all system and application programmers know about those JCL symbols.
You can define names for JCL symbols that are the same as system symbol names. When a JCL symbol has the same name as a system symbol, the substitution text for the JCL symbol overrides the substitution text for the system symbol. For example, if JCL defines a symbol with the name &SYSNAME, which is also the name of a system symbol, the system uses the substitution text that is defined in the JCL.
Defining default substitution texts to JCL symbols: The substitution texts that you define to JCL symbols on the PROC statement serve as defaults. You should assign default values to all JCL symbols in a procedure. The system uses the default values on the PROC statement when no calling EXEC statement or SET statement overrides them.
Using special characters in substitution texts: If a substitution text contains certain special characters, enclose the substitution text in apostrophes (for example, LOC='O''HARE'). The enclosing apostrophes are not considered to be part of the substitution text. See Table 2 for a list of special characters.
If the substitution text contains multiple ampersands and is not enclosed in apostrophes, the system treats each pair of ampersands as a single character.
If the special characters include apostrophes, code each apostrophe as two consecutive apostrophes. You must code four consecutive apostrophes in substitution texts that are to be substituted into a parameter that is enclosed in apostrophes. For example:
produces the following equivalent JCL, which is processed correctly:
However, if you code the following:
The equivalent JCL is:
The system fails this statement because the apostrophes resulting from the substitution are unbalanced.
When you want to code a JCL symbolic that consists of two parameters separated by a comma, you may have to enclose the JCL symbolic in triple apostrophes. For example:
The substitution JCL would be:
If the substitution text begins and ends with matched parentheses, do not enclose the value in apostrophes. The parentheses are considered part of the substitution text. For example:
If the substitution text within the parentheses contains apostrophes, the apostrophes are considered part of the substitution text. The system does not remove them.
Syntax for nullifying JCL symbols: To nullify a JCL symbol, code:
For example, if the JCL symbol &NUMBER appears in one or more DD statements in a procedure, code one or more of the following to nullify UNIT=&NUMBER:
When nullifying JCL symbols, keep the following in mind:
The following sections explain special considerations to make when JCL symbols are positional and not positional.
When a JCL Symbol is Positional: When a JCL symbol is a positional parameter, and another parameter follows it, code a comma to omit the positional parameter. Code commas both before and after the JCL symbol; the required commas remain after the JCL symbol is nullified. For example, &NUMBER for the unit count:
When &NUMBER is nullified, the parameter correctly becomes:
When a JCL Symbol is Not Positional: When a JCL symbol is not a positional parameter, do not code a comma to omit the parameter. Do not code a comma before the JCL symbol; no commas remain after the JCL symbol is nullified. For example, serial numbers in the VOLUME=SER parameter:
If either of the JCL symbols is nullified, a leading or trailing comma does not remain. If you nullify &FIRST and assign 222222 for &SECOND, the parameter correctly becomes:
If you nullify &SECOND and define 111111 to &FIRST, the parameter correctly becomes:
Code a comma when it is required in a substitution text. Enclose the comma in apostrophes (because it is a special character). For example:
Copyright IBM Corporation 1990, 2014