There are 3 important Statements in a JCL. These are –
- JOB Statement
- EXEC Statement
- DD Statement
This is the first statement in a JCL. In JOB statement, you have to provide the name of the JCL, the accounting information, class, msgclass, msglevel and some other parameters. We will cover all the parameters in detail as we move further in this tutorial.
Example of a JOB statement
//COPYCURR JOB (456),'TUTORIALBRAIN', // CLASS=A,MSGCLASS=A,MSGLEVEL=(1,1), // NOTIFY=&SYSUID
This is the shorthand for EXECUTION. EXEC statement marks the beginning of a step in a JCL or procedure.
- EXEC statement contains the program, utilities, and procedures where we use it for execution of a step in a JCL.
- JCL allows Maximum 255 steps it means, a JCL can have a maximum of 255 ‘EXEC’ statements.
Note: Step name in ‘EXEC’ statement is optional but when the step name is omitted, no reference can be made to that step. Hence, it is always advisable to provide the name of the step in ‘EXEC’ statement. It is better to provide a meaningful name of the step name and step name can be maximum of 8 characters.
Example of an EXEC statement
//COPYDATA EXEC PGM=IEBGENER
DD is the shorthand for Data definition. The definition of files related details are mentioned here like input and output resources, the way to access the file, space, and volume related to the files are also listed here. It must follow the EXEC statement after at least one space. An ‘EXEC‘ statement can have multiple DD statements under it.
– Describes the dataset or I/O resources required by the program
– Source of input and where the output needs to be kept.
– All DD statement for a single job must follow the EXEC statement.
– DD name must be 1 to 8 characters long (alphanumeric or national characters allowed)
The program must be in any one of the libraries-
- System library
- Private library – JOBLIB or STEPLIB are included in DD statement for the usage of a private library
- Temporary library – It is used inside a program. For example, a temporary library is created in step1 so that step3 can use it later. You can put the load module in a temporary library until it is fully tested.
Example of DD statements
//SYSPRINT DD SYSOUT=* //SYSOUT DD SYSOUT=* //SYSDUMP DD SYSOUT=* //SYSUT1 DD DSN=MATEKS.SALES.WEEK(-1),DISP=SHR //SYSUT2 DD DSN=MATEKS.TEST.PS4, // DISP=(NEW,CATLG,DELETE), // SPACE=(TRK,(1,2),RLSE), // UNIT=SYSDA, // DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800) //SYSIN DD DUMMY
- DDNAME specifies a name for the DD statement. DD name is optional. It begins at column 3 and must end at or before column 10
- DD operation field starts after the DD name – starts from 12 up to 15 column.
- DSN is a Keyword Parameter. The physical name of the input or output file is provided here
- Positional parameters are parameters which should always follow a particular order
- Keyword parameters are parameters which do not follow a particular order
- UNIT and DISP parameters are provided
- Other space-related parameters are also provided in the DD statement.