Introduction to JCL
OpenFrame provides MVS (Multiple Virtual Storage) JCL which is equivalent to IBM Mainframe. This chapter describes the basic concept of MCL.
1. Syntax
The following describes syntax of JCL control statements.
1.1. JCL Control Statements
The following figure shows syntax of JCL control statements.
Field | Description |
---|---|
Name |
Specifies the name of a JCL statement. It is used to separate the statement from other statements or to allow the statement to be referenced. The name must begin in column 3 and have no more than eight characters. Alphabetic characters and numeric digits can be used. The first character must be an alphabetic character. Comment, delimiter, and null statements do not have a name. |
Operation |
Specifies the operation of a JCL statement. If the statement has a name, one or more empty spaces must be preceded by the name. If not, the operation must begin in column 4. Comment, delimiter, and null statements do not have an operation. |
Operand |
Specifies operands separated each by commas (,). Operands are written after an operation. One or more empty spaces are required between the operation and operands. Comment, delimiter, null, and PEND statements do not have an operand. |
Comments |
To describe comments after operands, one or more empty spaces are required between operands and comments. If operands are omitted in a statement that can have operands (such as JOB, EXEC, DD, and PROC statements), comments cannot be used. Null statements cannot have comments. |
Continued operand |
If a JCL control statement cannot be written in a single line, it can be written across multiple lines with the method described following this table. The continuation cannot be used for comment, delimiter, and null statements. For more information, refer to "Continuation of JCL Statements". |
Ignored space |
Arbitrary characters can be written in columns 73 to 80. Characters after column 80 are ignored by the system. |
Continuation of JCL Statements
Continuation of operands, commands, and quoted character lines can be used as follows:
-
Continuation of operands 1
-
If the last operand ends with a comma (,) before column 71, it is determined that the continuation of operands will be used.
-
A continued line must begin with "//" in columns 1 and 2.
-
A continued line cannot contain a name.
-
Continued operands are written starting from column 4 until column 16.
-
-
Continuation of operands 2
-
If a character other than an empty space is written in column 72 when the last operand does not end with a comma (,) and comments are not described, it is determined that the continuation of operands will be used.
-
A continued line must begin with "//" in columns 1 and 2.
-
A continued line cannot contain a name.
-
Continued operands are written starting from column 4 until column 16. A comma (,) must be written first to indicate the start of operands.
-
-
Continuation of comments
If a character other than an empty space is written in column 72 when comments are described after operands in a control statement that can have comments, it is determined that comments will be continued to the next line.
-
Continuation of quoted character lines
If a value of an operand begins with a single quotation mark (') and there is no close single quotation mark in the same line, it is determined that the next line contains a part of the same input. The continued line must begin with "//" in columns 1 and 2, and the contents must begin in column 4 until column 16.
Examples of continuation are:
-
Example 1
In the following example, it is determined that continuation is used according to the "continuation of operand 1" rule.
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ), // MSGLEVEL=(1,1)
-
Example 2
In the following example, the "continuation of operand 1" rule is applied even if comments are described after a comma (,).
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ), this is comment // MSGLEVEL=(1,1)
-
Example 3
In the following example, the "continuation of operand 1" and "continuation of comments" rules are applied because the last operand ends with a comma (,), and comments exist and column 72 is marked. If the two rules are met, the "continuation of operand 1" takes priority over the "continuation of comments" rule. Therefore, the contents in the next line are recognized as operands, not comments.
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ), this is comment A // MSGLEVEL=(1,1)
-
Example 4
In the following example, the "continuation of operand 2" rule is applied because column 72 is marked although the last operand does not end with a comma (,) and it is without comments.
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ) B // ,MSGLEVEL=(1,1)
-
Example 5
In the following example, the "continuation of comments" rule is applied because the last operand does not end with a comma (,), comments exist and column 72 is marked. Therefore, the contents (MSGLEVEL=(1,1)) in the next line are recognized as comments.
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ) this is comment C // ,MSGLEVEL=(1,1)
-
Example 6
In the following example, the "continuation of quoted character lines" rule is applied. The value of the PARM is "this is tmaxsoft program argument."
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ),MSGLEVEL=(1,1) //STEP1 EXEC PGM=TMAXSOFT,COND=(0,NE),PARM='this is tmaxsoft program a // rgument'
-
Example 7
In the following example, "tmaxsoft_" means that an empty space is preceded by "tmaxsoft." The empty space is considered as a part of the value. Therefore, the value of the PARM is "this is tmaxsoft program argument."
123-------------------------------------------------------------------72 //JOB1 JOB CLASS=A,MSGCLASS=A,COND=(0,EQ),MSGLEVEL=(1,1) //STEP1 EXEC PGM=TMAXSOFT,COND=(0,NE),PARM='this is tmaxsoft_ // program argument'
1.2. JES2 JCL Control Statements
The following figure shows syntax of JES2 JCL control statements.
Field | Description |
---|---|
Operation |
Specifies the operation of a JES2 JCL statement. It must be preceded by "/*" and specified from column 3. |
Operand |
Specifies operands separated each by commas (,). |
Ignored space |
Arbitrary characters can be written in columns 73 to 80. Characters after column 80 are ignored by the system. |
2. Operands
There are two methods for writing a JCL operand: positional operand and keyword operand.
2.1. Positional Operands
Positional operands have fixed positions. Therefore, their value are specified according to their positions.
The following rules are applied to positional operands.
-
Each operand is separated by a comma (,).
value1,value2,value3
-
Even if positional operands are omitted, commas (,) must remain to indicate the positions.
value1,,value3
-
If there is no other positional operands following the positional operand to omit, commas (,) can also be omitted since there are no further operands to separate.
value1,value2,,keyword = value4
value1,value2,keyword = value4
-
If there is no keyword operand following a positional operand, the last comma (,) must be omitted.
value1,value2
2.2. Keyword Operands
Keyword operands have a specified for a keyword with an equals sign (=).
keyword = value
The following rules are applied to keyword operands.
-
Each keyword operand is separated by a comma (,). Since keyword operands can be used regardless of positions, when they are omitted, commas (,) can be also omitted.
-
The order of keyword operands has no meaning except for the PROC and PGM operands in an EXEC statement.
-
When both positional and keyword operands are used, all positional operands are written before keyword operands.
-
If all positional operands are omitted, no comma (,) is needed to be specified before a keyword operand.
2.3. Notation
Notation for operands is as follows:
-
[] (brackets)
Operands enclosed in these symbols can be omitted.
-
Example
The following description represents the following four cases.
A[,B][,C]
-
A
-
A,B
-
A,C
-
A,B,C
-
-
-
{} (braces)
Operands enclosed in these symbols are longitudinally aligned one by one, and one of them is selected.
-
Example
The following description represents the following two cases.
{B} {C}
-
B
-
C
-
-
-
| (vertical bar)
When multiple operands are delimited by this symbol, one of them is selected.
-
Example
The following description represents the following two cases.
{ PS | PSU }
-
PS
-
PSU
-
-
-
Bold
If no value is specified in braces ({, }), the bold word is used by default.
-
Example
In the following description, if the FREE parameter is omitted, it has END as the default value.
FREE = {END | CLOSE}
-
-
… (ellipsis)
The item that is immediately followed by this symbol can be repeatedly specified.
-
Specified Type
Descriptions of each type are as follows:
-
Numeric digits
Meaning
0|1|2|3|4|5|6|7|8|9
Example
0, 1, 9
-
Alphabetic characters
Meaning
A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|$|#|@
Example
C,J,@,$
-
Special characters
Meaning
Arbitrary characters other than numeric digits and alphabetic characters. Among the characters, a comma (,), single quotation mark ('), equal sign (=), left parenthesis ((), right parenthesis ()), and blank space ( ) must be enclosed in single quotation marks (', ').
Example
, , . , / , ' , ( , ) , * , & , + , - , = , empty space
-
Alphanumeric characters
Meaning
Numeric digits, alphabetic characters, and combinations of those.
Example
A, 7, A56, 8X, ABC, 997
-
Unsigned integer
Meaning
Unsigned numeric digits and combinations of those.
Example
01, 375
-
Integer
Meaning
Signed or unsigned numeric digits and signed or unsigned combinations of those.
Example
99, +76, -143
-
Special character line
Meaning
Numeric digits, alphabetic characters, special characters, and combinations of those.
Example
32 A5, *315'?&A
-
Quoted character line
Meaning
<alphabetic characters, numeric digits> | '<special character lines>'. To use a single quotation mark (') in a special character line, specify the single quotation mark twice to make a system recognize a single quotation mark.
A system considers two ampersands (&&) specified one after another as a single ampersand. It is the same as when only a single ampersand(&) is specified. If a quoted character line is enclosed in single quotation marks, the single quotation marks are not counted into the number of characters.
Example
'5&23' '8=/' 'A''B', 8X3B
-
Symbol name
Meaning
Combinations of numeric digits and alphabetic characters, beginning with an alphabetic character. The length can be up to eight characters.
Example
Z7@, LMN, A123BC
-
2.4. Examples
The following example specifies account identification information (A001) and a programmer name (TMAX.PROGRAM) as positional operands and CLASS and MSGCLASS as keyword operands in the JOB statement.
//JOB1 JOB A001,TMAX.PROGRAM,CLASS=A,MSGLEVEL=(1,1)
The first comma cannot be omitted when account identification information is omitted.
//JOB1 JOB ,TMAX.PROGRAM,CLASS=A,MSGLEVEL=(1,1)
If a programmer name is omitted, the comma for the omission can be omitted because there are no more positional operands.
//JOB1 JOB A001,CLASS=A,MSGLEVEL=(1,1)
If both account identification information and programmer name are omitted, the following is valid.
//JOB1 JOB CLASS=A,MSGLEVEL=(1,1)
Specifying Parameters
Values of an operand can be written with a list of parameters. The rules described in Positional Operands and Keyword Operands are applied to each parameter.
The following example specifies parameters.
LABEL=(3,SL,PASSWORD,OUT,RETPD=350)
The following example omits the PASSWORD positional parameter.
LABEL=(3,SL,,OUT,RETPD=350)
The following example specifies only the SL and RETPD parameters.
LABEL=(,SL,RETPD=350)
3. JCL
The following describes the start and end of JOB used in JCL and the order of statements.
3.1. Start and End of JOB
The start and end of JOB are as follows:
-
Start of JOB
A JOB statement indicates the start of JOB.
-
End of JOB
A null statement or a JOB statement that represents the start of the next JOB indicates the end of JOB. In the case of an input stream, the last JOB in the stream indicates the end of JOB.
In a JOB, there must be one or more STEP. That is, one or more EXEC statements must exist between a JOB statement and the next JOB statement. The start and end of JOB STEP are as follows:
-
Start of JOB STEP
The start of an EXEC statement indicates the start of JOB STEP.
-
End of JOB STEP
An EXEC statement that represents the start of the next JOB STEP indicates the end of JOB STEP. In the case of JOB’s last STEP, the end of JOB means the end of JOB step.
3.2. Order of Statements
JOB STEPs must be used in each JOB range. Therefore, an EXEC statement must be used after a JOB statement.
Order of JCL Control Statements
The order of JCL control statements is as follows:
-
JOB statement
Indicates the start of JOB. If there is a PRIORITY statement, a JOB statement must be used after the PRIORITY statement.
-
EXEC statement
There are following three cases.
-
When an EXEC statement is not used in a procedure, it must be used after JOB, JOGLIB DD, and JOBCAT DD statements and at the front of each JOB STEP.
-
When an EXEC statement is used in an input stream procedure, it must be used after a PROC statement and at the front of each procedure STEP.
-
When an EXEC statement is used in a catalog procedure, it must be used at the front of each procedure STEP, and after a PROC statement if there is a PROC statement.
-
-
DD statement
There are following two cases.
-
JOBLIB DD statements and JOBCAT DD statements
Used just after a JOB statement and before an EXEC statement that defines the first JOB STEP. JES2 JCL control statement can be used between a JOB statement and these DD statements.
-
Other DD statements
Used after an EXEC statement.
-
-
Delimiter statement
Used at the end of the SYSIN data set.
-
Null statement
Used at the end of JOB. It cannot be used in input stream procedures or catalog procedures.
-
Comment statement
Can be used in any positions within the range of JOB. However, it cannot be used in the in-stream data set.
-
PROC statement
There are following two cases.
-
In an input stream procedure
Used at the front of each input stream procedure. Used after a JOB statement and before JOB STEP that calls the input stream procedure.
-
In a catalog procedure
Used at the front of a catalog procedure.
-
-
PEND statement
Used at the end of each input stream procedure.
Order of JES2 JCL Control Statements
The order of JES2 JCL control statements is as follows:
-
PRIORITY statement
Used just before a JOB statement.
-
Other statements than PRIORITY statement
Can be used in anywhere in the statement.