Introduction to JCL
This is a short introduction to JCL and how to use it. It shows a number of the parameters for the various JCL statements but does not describe all possible parameters.
JCL was introduced with the first IBM Mainframe and is still used on the newest z/OS system. As new systems have come out features have been added by the JCL on the OS/360 computer is very much alive on newer machines. The original mainframe computers had card readers, tapes, and printers. This was the situation with MFT and MVT, the immediate predecessors to MVS. Even today most mainframes still have card readers.
To run a job a deck of cards would be created and read into the system by the card reader. The system would see the jcl and would execute it. On MVS 3.8J it is possible to submit a text file containing jcl lines to the card reader. It is also possible and quite common to put the JCL in a partitioned data set and submit the job from there. Here is a picture of a simple job from a PDS.
A job consists of three kinds of statements; JOB, EXEC, and DD. The JOB statement provides parameters and keywords about the entire job. The EXEC statement describes programs that are to be executed. There may be more than one EXEC statement in a job stream. Each EXEC statement is called a step. The DD statement describes the datasets, printers, and other devices that the EXEC program requires to execute.
While talking about jcl is is common to use the term "card" instead of "record" or "row". In this tutorial "card" will be used.
JCL Card Definition
A jcl card card be split up into four sections.
The job card is the card that defines the job. It beings with two slashes (//). The next up to eight characters is the job name. The name can be from 1 to 8 characters long. It is followed by at least one space after which is the word 'JOB'. Following the word is at least one space.
After the work JOB are positional and keyword values that provide some parameters to the job. Each parameter is seperated by a comma (,). If there are spaces in a paramter it must be inclosed by single quotes. Otherwise it will be the termination of the job card since the first space after the paramters have started indicates the end of card. A job card can be continued to multiple cards by ending the last parameter on the card with a comma (,). The next card begins with two slashes (//) followed by at least one space before the next parameter. The first parameter is positional and is job accounting information. Many production systems use accounting parameters on jcl to spread computing costs to various departments. The second parameter is also positional and is the programmer name. Both the first and second parameters are optional.
The keyword parameters begin with the keyword and are immediately followed by an equals sign (=). The keywords for the JOB card are:
The EXEC card begins with two slashes (//), followed by a name, followed by at least one blank, followed by the word EXEC, followed by at least one blank followed by PGM=program where progam is a program that can be loaded from the system. An EXEC card is considered to be a step. It is followed by the DD cards. After the DD cards another step can be started by having another EXEC statement. Some jobs can have 20 or more steps.
A DD statement allows a program to communicate with devices outside of the program itself. A DD statement consists of from one to just about any number of cards. The statement begins with two slashes (//) followed by the name that the program uses to refer to the statement. That name is followed by at least one space and then the characters DD. The DD may be followed by one of three types of parameters. These parameter are:
The uses of these parameters and keywords will be explained as we need them when we develop programs and utilities.
Ending a JCL Job Stream
When all of the EXEC steps and their DD definitions have been entered a job stream is closed by a card with two slashes(//). Technically the two slash card is not required. However if there is a submission of more than one job in a stream of cards the two slashes are how the system knows the job is at an end. Then when it reads the next JOB card it will not register an error.