# JCL (Job Control Language)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Paradigm scripting language IBM 1974 DOS, JCL OS .jcl {{#property:P856}}

Job Control Language (JCL) is the control language for batch processing in a mainframe environment and is one of the scripting languages. The object of the JCL is to specify the programs to be executed, their sequence and a runtime environment (connection to physical hardware, so the input and output devices and files). Belonging to a concrete task programs or program sequences and the required environment are bundled using the JCL in so-called jobs that are defined as executable units under the multitasking. The jobs provide the actual application programs superordinate level is at system level and are comparable in this respect with the shell scripts in Unix or the batch files in MS-DOS or Windows.

This article describes the JCL under IBM z / OS. Other mainframe operating systems such as VSE also use JCL called languages, but have a very different syntax.

## Features common to DOS and OS JCL

### Conception

In the JCL, the unit is the job (the job), which consists of one or more steps (steps). Each step consists of running a specific program. Thus, a job which is to create a report could be composed of the following steps:

• Selecting the proper records using a program and storing the results in a temporary file;
• sorting of results using an appropriate utility;
• creation of the report itself using another program that does the math - totals, etc. - And the shaping of the relevant information;
• report display, etc.

Punch card corresponding to a command line JCL using basic password that is called "maps" (rest of the time when each line of script, program, etc. was supplied to the computer using a punch card). A JCL script will begin with the JOB card that enables:

• to give a name to the job;
• to identify the group that will receive the implementation report;
• define how the job should be executed

It is possible to create JCL scripts that may be called in other JCL scripts using if necessary the parameters. Such scripts are called procedures.

Note: By metonymy, the word also refers to the script JCL (job) itself. Thus, IBM environment, we do not talk JCL script but simply JCL (eg. Start or run a JCL)

### Basic syntax

Both DOS and OS JCL have a maximum usable line length of 80 characters, because when DOS/360 and OS/360 were first used the main method of providing new input to a computer system was 80-column punched cards. It later became possible to submit jobs via disk or tape files with longer record lengths, but the operating system's job submission components ignored everything after character 80.

All commands, parameter names and values have to be in capitals, except for UNIX System Services|USS filenames.

All lines except for in-stream input (see below) have to begin with a slash "/", and all lines which the operating system processes have to begin with two slashes // - always starting in the first column. However, there are two exceptions: the delimiter statement and the comment statement. A delimiter statements begins with a slash and an asterisk (/*), and a comment statement in OS JCL begins with a pair of slashes and asterisk (//*) or an asterisk in DOS JCL.

Many JCL statements are too long to fit within 71 characters, but can be extended on to an indefinite number of continuation cards by:

OS JCL DOS JCL
Ending all actual JCL cards except the last at a point where the syntax requires a comma (,) Ending all actual JCL cards except the last at a point where the syntax requires a comma (,) and a non-blank character in column 72
Starting each continuation card with // in column 1 and then at least 1 space Starting each continuation card with spaces and continuing in column 15

The structure of the most common types of card is:

OS JCL DOS JCL
• //
• Name field for this statement, following // with no space between. If this statement does not have a name at least one blank immediately follows the //.
• Space(s)
• Statement type
• Space(s)
• Parameters, which vary depending on the statement type, separated by commas and with no space between them.
• // (spaces if this is a continuation of a previous line)
• Statement type for this statement, following // with a space between.
• Space(s)
• Name of resource
• Space(s)
• Parameters, which vary depending on the statement type, separated by commas and with no space between them. Positional parameters, followed by keyword parameters.

### In-stream input

DOS and OS JCL both allow in-stream input, i.e. "cards" which are to be processed by the application program rather than the operating system. Data which is to be kept for a long time will normally be stored on disk, but before the use of interactive terminals became common the only way to create and edit such disk files was by supplying the new data on cards.

DOS and OS JCL have different ways of signaling the start of in-stream input, but both end in-stream input with /* at column 1 of the card following the last in-stream data card. This makes the operating system resume processing JCL in the card following the /* card.

OS JCL DD statements can be used to describe in-stream data, as well as data sets. A DD statement dealing with in-stream data has an asterisk (*) following the DD identifier, e.g. //SYSIN DD *. JCL statements can be included as part of in-stream data by using the DD DATA statements.

DOS JCL Simply enter the in-stream data after the EXEC card for the program.

### Complexity

Much of the complexity of OS JCL, in particular, derives from the large number of options for specifying Data set (IBM mainframe)|dataset information. While files on unix-like operating systems are just an arbitrary collection of bytes, files on OS/360 and successors have defined file types and sizes, record types and lengths, block sizes and device-specific information such as Magnetic tape data storage|magnetic tape density and label information. Although there are system defaults for many options there is still a lot that has to be specified by the programmer, through a combination of JCL and information coded in the program. The more information coded in the program the less flexible it is, so most information is usually supplied through JCL.For example, to File copying|copy a file on Unix the user enters a command like:

cp file dest


JCL like the following might be used to copy a file on OS/360:

//IS198CPY JOB (IS198T30500),'COPY JOB',CLASS=L,MSGCLASS=X
//COPY01   EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1   DD DSN=OLDFILE,DISP=SHR
//SYSUT2   DD DSN=NEWFILE,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(CYL,(40,5),RLSE),
//            DCB=(LRECL=115,BLKSIZE=1150)
//SYSIN    DD DUMMY


A second explanation for the complexity of JCL is the different expectations for running a job than are found in a IBM PC|PC or unix environment.

• Low-end System/360 CPUs were less powerful and more expensive than the mid-1980s PCs for which MS-DOS was designed. OS/360 was intended for systems with a minimum memory size of 32&nbsp;KB and DOS/360 for systems with a minimum of 16&nbsp;KB. A, IBM 2030|360/30 CPU&mdash;low-end when System/360 was announced in 1964&mdash;processed 5K to 13K instructions per secondThe first IBM PC in 1981 had 16&nbsp;KB or 64&nbsp;KB of memory and would process about 330,000 instructions per second As a result, JCL had to be easy for the computer to process, and ease of use by programmers was a much lower priority. In this era, programmers were much cheaper than computers.
• JCL was designed for batch processing so it has to tell the operating system everything, including what to do depending on the result of the step. For example, DISP=(NEW,CATLG,DELETE) means "if the program runs successfully, create a new file and catalog it; otherwise delete the new file." Programs run on a PC frequently depend on the user to clean up after processing problems.
• System/360 machines were designed to be shared by all the users in an organization. So the JOB card tells the operating system how to bill the user's account (IS198T30500), what predefined amount of storage and other resources may be allocated (CLASS=L), and several other things. //SYSPRINT DD SYSOUT=* tells the computer to print the program's report on the default printer (computing)|printer which is loaded with ordinary paper, not on some other printer which might be loaded with blank checks. DISP=SHR tells the operating system that other programs can read OLDFILE multiprogramming|at the same time.

Later versions of the DOS/360 and OS/360 operating systems retain most features of the original JCL&mdash;although some simplification has been made, to avoid forcing customers to rewrite all their JCL files. Many users save as a procedure any set of JCL statements which is likely to be used more than once or twice.

The syntax of OS JCL is similar to the syntax of Macro instruction|macros in System/360 assembly language, and would therefore have been familiar to programmers at a time when many programs were coded in assembly language.

## DOS JCL

### Positional parameters

 // TLBL TAPEFIL,'COPYTAPE.JOB',,,,2
// ASSGN SYS005,200
// DLBL DISKFIL,'COPYTAPE.JOB',0,SD
// EXTENT SYS005,VOL01,1,0,800,1600


DOS JCL parameters are positional, which makes them harder to read and write, but easier for the system to parse.

• The programmer must remember which item goes in which position in every type of statement.
• If some optional parameters are omitted but later ones are included, the omitted parameters must be represented by commas with no spaces, as in the TLBL statement above.

DOS JCL to some extent mitigates the difficulties of positional parameters by using more statements with fewer parameters than OS JCL. In the example the ASSGN, DLBL and EXTENT statements do the same work (specifying where a new disk file should be stored) as a single DD statement in OS JCL.

### Device dependence

In the original DOS/360 and in most versions of DOS/VS one had to specify the model number of the device which was to be used for each disk or tape file&mdash;even for existing files and for temporary files which would be deleted at the end of the job. This meant that, if a customer upgraded to more modern equipment, many JCL files had to be changed.

Later members of the DOS/360 family reduced the number of situations in which device model numbers were required.

### Manual file allocation

DOS/360 originally required the programmer to specify the location and size of all files on Direct-access storage device|DASD. The EXTENT card specifies the volume on which the extent resides, the starting absolute track, and the number of tracks. for z/VSE a file can have up to 256 extents on different volumes.

## OS JCL

OS JCL consists of three basic statement types:

• JOB statement, which identifies the start of the job, and information about the whole job, such as billing, run priority, and time and space limits.
• EXEC statement, which identifies the program to be executed in this step of the job, and information about the step.
• DD (Data Description) statements, which identify a data file to be used in a step, and detailed info about that file. DD statements can be in any order within the step.

Right from the start, JCL for the OS family (up to and including z/OS) was more flexible and easier to use.

The following examples use the old style of syntax which was provided right from the launch of System/360 in 1964. The old syntax is still quite common in jobs that have been running for over 20 years with only minor changes.

### Rules for Coding JCL Statements

Each JCL Statement is Divided into 5 fields.

 Identifier-Field Name-Field Operation-Field Parameter-Field Comments-Field
^          ^               ^               ^
no space     space          space           space


Identifier-Field should be concatenated with Name-Field, i.e. there should be no spaces between them.

• Identifier-Field (//): The identifier field indicates to the system that a statement is a JCL statement rather than data. The identifier field consists of the following:
• Columns 1 and 2 of all JCL statements, except the delimiter statement, contain //
• Columns 1 and 2 of the delimiter statement contain /*
• Columns 1, 2, and 3 of a JCL comment statement contain //*
• Name-Field: The name field identifies a particular statement so that other statements and the system can refer to it. For JCL statements, it should be coded as follows:
• The name must begin in column 3.