You have looked at JCL
statements and procedures. Now, you need to understand several rules for coding
them. The way the code is arranged in a statement, like the way phrases and
sentences are put together in everyday spoken language, is known as
syntax.
This unit presents most of the syntax rules. Typically, the first few rules will be all you need as you learn the fundamentals of JCL coding.
After completing this unit, you should be able to:
*Keeping It Simple
You can use as many input lines as necessary to code your JCL statements, but you'll want to avoid long or unwieldy statements. The primary rule is KEEP IT SIMPLE!
Code your JCL statements so that they are structured and easy to read. This makes everyone's job easier.
Let's examine in detail the rules for coding JCL statements.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
*Reviewing the Format
Here you see the general format of a JCL statement. JCL statements are composed of these fields:
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 EXEC PGM=PAY012
|| |
|| |
// begins a JCL information ends
JCL statement. before position 72.
*Rules 1 and 2
Consider the first two syntax rules:
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*The Next Two Rules
The next two rules deal with the name field (DDIN), the operation field (DD), and parameters (MASTER, OLD, CATLG) of the operands field.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*Rule 3
Fields are separated by one or more blank spaces. Remember the primary rule? Keep it simple!
Here's a place you can apply it: use several spaces to separate and distinguish fields. This makes the statement easier to read.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*Rule 4
Parameters are separated by commas. The parameters field is composed of one or more parameters.
You may not use blank spaces between parameters. The parameters field, therefore, looks like this:
parameter1,parameter2,parameter3,......
Topic 3.1: Continuing Statements
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//TAPEIN DD DSN=CUSTFILE,DISP=OLD,
// UNIT=TAPE,VOL=SER=008908
*Breaking Up Your Code
The next item on the agenda for statement syntax is how to continue JCL statements. Not all the parameters for a JCL statement need to be coded on the same line. In fact, it is desirable to use several lines for one operation so that your JCL is easy to read.
Only the comment (//*), delimiter (/*) and null (//) statements may not be continued.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//TAPEIN DD DSN=CUSTFILE,DISP=OLD,
// UNIT=TAPE,VOL=SER=008908
*The Rules for Continuing
These are the rules for continuing a JCL statement:
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
// EXEC PGM=PAY012
*The name Field
Let's now look at the rules specific to each field.
The name field is the statement identifier. Other JCL statements can refer to the information contained on this statement by using the name.
The name field must start in position 3. There are no spaces between the // and the name.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
// EXEC PGM=PAY012
*Valid Characters
The name field can be made up of 1-8 alphanumeric (A-Z, 0-9) and national (@ # $) characters.
The first character of the name field must be alphabetic or national.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 PGM=PAY012
*The operation Field
Next, the operation field defines the type of JCL statement.
This field must start at or before position 16. Remember, the operation is a field and must be separated from the preceding and following fields by one or more spaces.
JOB, EXEC, and DD are examples of the contents of operation fields.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 EXEC PGM=PAY012 STEP TO BACKUP MASTER FILE
*The comments Field
Let's save the parameters field for last and look at the comments field.
The comments field is optional. It may contain any information that you care to put there.
This is the only field that can be coded past position 71.
*The Comment Statement
Another way to include a comment in JCL is with the comment statement.
//* COMMENTS
1...+....1....+....2....+....3....+....4
The asterisk (*) in position 3 indicates the statement contains only comments.
By using a series of comment statements, you can create a block to make your comments stand out.
//********************************************
//* *
//* COMMENTS *
//* *
//********************************************
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
*The Parameters Field
Now it's time to look at the syntax for parameters. The parameters field is composed of parameters.
As you know from a previous rule, each of the parameters must be separated by a comma. However, the parameters field itself must be separated from the operation field and the comments field, if any, by one or more spaces.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
accounting information,programmer's name
*Positional Parameters
There are two types of parameters — positional and keyword — and several rules defining how to code them.
A positional parameter is recognized by the position it holds within the parameters field. It must be coded in the proper sequence to be recognized.
The only identifying factor of positional parameters is their position. The positional parameters in the example give the accounting information and the programmer's name.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
*Keyword Parameters
A keyword parameter is identified by the keyword followed by an equals sign (=) and the variable information.
They may be coded in any sequence as long as they follow the positional parameters and are separated by commas.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=OLD.MASTER,DISP=(OLD,DELETE)
*Subparameters
A parameter may be composed of subparameters. Subparameters follow the same syntax rules as parameters and must be enclosed in parentheses.
The next few pages describe the rules for coding subparameters. Because some of the rules involve options that you are not yet familiar with, you will not be questioned on the material. Just take a look at the statements to become familiar with the formats. You will often see statements coded this way.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
*Separating Subparameters with Commas
Let's summarize the rules for subparameters.
1. Subparameters are separated by commas.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSZE=800)
RETAIN is positional
SER= is keyword
*Ordering the Subparameters
2. Positional subparameters must precede keyword subparameters.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
*Using Parentheses
3. A list of subparameters must be enclosed in parentheses unless you include only one subparameter.
For example: DCB=BLKSIZE=800 does not need parentheses.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LREL=80,BLKSIZE=800)
LABEL=(1,SL)
includes the default
*Omitting Defaults
4. If a subparameter is a default value, you can omit it, but you must include a comma to mark its place.
This unit presents most of the syntax rules. Typically, the first few rules will be all you need as you learn the fundamentals of JCL coding.
After completing this unit, you should be able to:
- Recall the general syntax rules for coding JCL
- Continue statements on multiple lines
- Demonstrate proper use of the name, operation, and
comments fields, as well as comment statements
- Recognize positional and keyword parameters
- Correct syntax errors in JCL code
*Keeping It Simple
You can use as many input lines as necessary to code your JCL statements, but you'll want to avoid long or unwieldy statements. The primary rule is KEEP IT SIMPLE!
Code your JCL statements so that they are structured and easy to read. This makes everyone's job easier.
Let's examine in detail the rules for coding JCL statements.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
*Reviewing the Format
Here you see the general format of a JCL statement. JCL statements are composed of these fields:
Field | Description |
---|---|
Name | This is any valid name you assign. |
Operation | This includes JOB, EXEC, DD and other operations. |
Operands | Each operation can have several parameters. |
Comments | Comments may be entered on any JCL statement. An entire line or lines of JCL can be comments. |
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 EXEC PGM=PAY012
|| |
|| |
// begins a JCL information ends
JCL statement. before position 72.
*Rules 1 and 2
Consider the first two syntax rules:
- JCL statements begin with a // in positions 1 and 2.
- Positions 3-71 may contain JCL information.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*The Next Two Rules
The next two rules deal with the name field (DDIN), the operation field (DD), and parameters (MASTER, OLD, CATLG) of the operands field.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*Rule 3
Fields are separated by one or more blank spaces. Remember the primary rule? Keep it simple!
Here's a place you can apply it: use several spaces to separate and distinguish fields. This makes the statement easier to read.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=MASTER,DISP=(OLD,CATLG) PAYROLL MASTER
*Rule 4
Parameters are separated by commas. The parameters field is composed of one or more parameters.
You may not use blank spaces between parameters. The parameters field, therefore, looks like this:
parameter1,parameter2,parameter3,......
Topic 3.1: Continuing Statements
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//TAPEIN DD DSN=CUSTFILE,DISP=OLD,
// UNIT=TAPE,VOL=SER=008908
*Breaking Up Your Code
The next item on the agenda for statement syntax is how to continue JCL statements. Not all the parameters for a JCL statement need to be coded on the same line. In fact, it is desirable to use several lines for one operation so that your JCL is easy to read.
Only the comment (//*), delimiter (/*) and null (//) statements may not be continued.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//TAPEIN DD DSN=CUSTFILE,DISP=OLD,
// UNIT=TAPE,VOL=SER=008908
*The Rules for Continuing
These are the rules for continuing a JCL statement:
- Stop coding the parameters before position 72.
- Interrupt the field at a parameter or subparameter.
- Include the separating comma. (In the example, note the comma after OLD.)
- Code a // in positions 1 and 2 of the next statement. Code a space in position 3. Continue coding the interrupted field in or before position 16. (In the example, note that UNIT starts in position 15).
- To continue a comments field, there are special rules. You must also code a non-blank character in position 72.
Topic 3.2: Rules for Fields
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
// EXEC PGM=PAY012
*The name Field
Let's now look at the rules specific to each field.
The name field is the statement identifier. Other JCL statements can refer to the information contained on this statement by using the name.
The name field must start in position 3. There are no spaces between the // and the name.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
// EXEC PGM=PAY012
*Valid Characters
The name field can be made up of 1-8 alphanumeric (A-Z, 0-9) and national (@ # $) characters.
The first character of the name field must be alphabetic or national.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 PGM=PAY012
*The operation Field
Next, the operation field defines the type of JCL statement.
This field must start at or before position 16. Remember, the operation is a field and must be separated from the preceding and following fields by one or more spaces.
JOB, EXEC, and DD are examples of the contents of operation fields.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//STEP1 EXEC PGM=PAY012 STEP TO BACKUP MASTER FILE
*The comments Field
Let's save the parameters field for last and look at the comments field.
The comments field is optional. It may contain any information that you care to put there.
This is the only field that can be coded past position 71.
*The Comment Statement
Another way to include a comment in JCL is with the comment statement.
//* COMMENTS
1...+....1....+....2....+....3....+....4
The asterisk (*) in position 3 indicates the statement contains only comments.
By using a series of comment statements, you can create a block to make your comments stand out.
//********************************************
//* *
//* COMMENTS *
//* *
//********************************************
Topic 3.3: Parameter Syntax
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
*The Parameters Field
Now it's time to look at the syntax for parameters. The parameters field is composed of parameters.
As you know from a previous rule, each of the parameters must be separated by a comma. However, the parameters field itself must be separated from the operation field and the comments field, if any, by one or more spaces.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
accounting information,programmer's name
*Positional Parameters
There are two types of parameters — positional and keyword — and several rules defining how to code them.
A positional parameter is recognized by the position it holds within the parameters field. It must be coded in the proper sequence to be recognized.
The only identifying factor of positional parameters is their position. The positional parameters in the example give the accounting information and the programmer's name.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//MYJOB JOB ACCT#24,MYNAME,CLASS=A,TIME=10
*Keyword Parameters
A keyword parameter is identified by the keyword followed by an equals sign (=) and the variable information.
They may be coded in any sequence as long as they follow the positional parameters and are separated by commas.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//DDIN DD DSN=OLD.MASTER,DISP=(OLD,DELETE)
*Subparameters
A parameter may be composed of subparameters. Subparameters follow the same syntax rules as parameters and must be enclosed in parentheses.
The next few pages describe the rules for coding subparameters. Because some of the rules involve options that you are not yet familiar with, you will not be questioned on the material. Just take a look at the statements to become familiar with the formats. You will often see statements coded this way.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
*Separating Subparameters with Commas
Let's summarize the rules for subparameters.
1. Subparameters are separated by commas.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSZE=800)
RETAIN is positional
SER= is keyword
*Ordering the Subparameters
2. Positional subparameters must precede keyword subparameters.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
*Using Parentheses
3. A list of subparameters must be enclosed in parentheses unless you include only one subparameter.
For example: DCB=BLKSIZE=800 does not need parentheses.
//name operation parameter1,parameter2,... comments
1...+....1....+....2....+....3....+....4....+....5....+....6....+....7..
//SYSUT2 DD DSN=MASTER,DISP=OLD,LABEL=(,SL),VOL=(RETAIN,SER=041765),
// UNIT=TAPE,DCB=(RECFM=FB,LREL=80,BLKSIZE=800)
LABEL=(1,SL)
includes the default
*Omitting Defaults
4. If a subparameter is a default value, you can omit it, but you must include a comma to mark its place.
Topic 3.4: Unit 3 Summary
In this unit you learned the following:- JCL statements begin with a // in positions 1 and 2.
- Positions 3-71 may contain JCL information.
- Fields are separated by one or more spaces.
- Parameters are separated by commas.
- JCL statements may be continued.
- The name field is the statement identifier.
- The operation field defines the type of JCL statement.
- Comments may continue past position 71. This field is optional.
- The operands field is composed of parameters.
- There are two types of parameters — positional and keyword.
- A parameter may be composed of subparameters. Subparameters follow the same syntax rules as parameters. They must be enclosed in parentheses when more than one subparameter is specified.
No comments:
Post a Comment