Terminology
Certain words or phrases used in conjunction to JCL are specific to IBM mainframe technology. * Dataset: a "dataset" is a file; it can be temporary or permanent, and located on a disk drive, tape storage, or other device. * Member: a "member" of a partitioned dataset (PDS) is an individual dataset within a PDS. A member can be accessed by specifying the name of the PDS with the member name in parentheses. For example, the system macro GETMAIN in SYS1.MACLIB can be referenced as SYS1.MACLIB(GETMAIN).McQuillen, ''System/360–370 Assembler Language'', pp. 288–289, 400. * Partitioned dataset: a "partitioned dataset" or PDS is collection of members, or archive, typically used to represent system libraries. As with most such structures, a member, once stored, cannot be updated; the member must be deleted and replaced, such as with the IEBUPDTE utility. Partitioned datasets are roughly analogous to ar-based static libraries in Unix-based systems. * USS: Unix system services, a Unix subsystem running as part of MVS, and allowing Unix files, scripts, tasks, and programs to run on a mainframe in a UNIX environment.Motivation
Originally, mainframe systems were oriented towardFeatures common to DOS and OS JCL
Jobs, steps and procedures
For both DOS and OS the unit of work is the job. A job consists of one or several steps, each of which is a request to run one specific program. For example, before the days of relational databases, a job to produce a printed report for management might consist of the following steps: a user-written program to select the appropriate records and copy them to a temporary file; sort the temporary file into the required order, usually using a general-purpose utility; a user-written program to present the information in a way that is easy for the end-users to read and includes other useful information such as sub-totals; and a user-written program to format selected pages of the end-user information for display on a monitor or terminal. In both DOS and OS JCL the first "card" must be the JOB card, which: * Identifies the job. * Usually provides information to enable the computer services department to bill the appropriate user department. * Defines how the job as a whole is to be run, e.g. its priority relative to other jobs in the queue. Procedures (commonly called ''procs'') are pre-written JCL for steps or groups of steps, inserted into a job. Both JCLs allow such procedures. Procs are used for repeating steps which are used several times in one job, or in several different jobs. They save programmer time and reduce the risk of errors. To run a procedure one simply includes in the JCL file a single "card" which copies the procedure from a specified file, and inserts it into the jobstream. Also, procs can include ''parameters'' to customize the procedure for each use.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/
", 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:
The structure of the most common types of card is:
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.
:An operand named DLM allowed specifying a delimiter (default is "/*"). Specifying an alternate delimiter allows JCL to be read as data, for example to copy procedures to a library member or to submit a job to the ''internal reader''.
:*An example, which submits a job to the ''Internal Reader'' (INTRDR) and then deletes two files is:
Complexity
Much of the complexity of OS JCL, in particular, derives from the large number of options for specifying dataset information. While files onDISP=(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.
tells the computer to print the program's report on the default 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
at the same time.
Later versions of the DOS/360 and OS/360 operating systems retain most features of the original JCL—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 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
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—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 DASD. TheEXTENT
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 or ''procedure'' to be executed in this step of the job,DD
(Data Definition) 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 Rules for coding JCL statements
Each JCL statement is divided into five 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.
** The name is 1 through 8 alphanumeric or national ($
, #
, @
) characters.
** The first character must be an alphabetic.
** The name must be followed by at least one blank.
* Operation-Field: The operation field specifies the type of statement, or, for the command statement, the command. Operation-Field should be coded as follows:
** The operation field consists of the characters in the syntax box for the statement.
** The operation follows the name field.
** The operation must be preceded and followed by at least one blank.
** The operation will be one of JOB
, EXEC
and DD
.
* Parameter-Field: The parameter field, also sometimes referred to as the operand field, contains parameters separated by commas. Parameter field should be coded as follows:
** The parameter field follows the operation field.
** The parameter field must be preceded by at least one blank.
** The parameter field contains parameters which are keywords that used in the statement to provide information such as the program or dataset name.
* Comments-Field: This contains Keyword parameters
SPACE
(how much disk space to allocate to a new file) and DCB
(detailed specification of a file's layout) in the example above. Sub-parameters are sometimes positional, as in SPACE
, but the most complex parameters, such as DCB
, have keyword sub-parameters.
Positional parameter must precede keyword parameters. Keyword parameters always assign values to a keyword using the equals sign (=
).
Data access (DD statement)
TheDD
statement is used to reference data. This statement links a program's internal description of a dataset to the data on external devices: disks, tapes, cards, printers, etc. The DD may provide information such as a device type (e.g. '181','2400-5','TAPE'), a volume serial number for tapes or disks, and the description of the data file, called the DCB
subparameter after the Device independence
From the very beginning, the JCL for the OS family of operating systems offered a high degree of device independence. Even for new files which were to be kept after the end of the job one could specify the device type in generic terms, e.g.,UNIT=DISK
, UNIT=TAPE
, or UNIT=SYSSQ
(tape or disk). Of course, if it mattered one could specify a model number or even a specific device address.
Procedures
Procedures permit grouping one or more "''EXEC PGM=''" and ''DD'' statements and then invoking them with "''EXEC PROC=''procname" -or- simply "EXEC procname" A facility called a Procedure Library allowed pre-storing procedures.PROC & PEND
Procedures can also be included in the job stream by terminating the procedure with a// PEND
statement, then invoking it by name the same was as if it were in a procedure library.
For example:
Parameterized procedures
OS JCL procedures were parameterized from the start, making them rather like macros or even simple subroutines and thus increasing their reusability in a wide range of situations.&
" are parameters which will be specified when a job requests that the procedure be used. The PROC statement, in addition to giving the procedure a name, allows the programmer to specify default values for each parameter. So one could use the one procedure in this example to create new files of many different sizes and layouts. For example:
Referbacks
In multi-step jobs, a later step can use a ''referback'' instead of specifying in full a file which has already been specified in an earlier step. For example:MYPR02
uses the file identified as NEWFILE
in step MYPR01
(DSN
means "dataset name" and specifies the name of the file; a DSN could not exceed 44 characters).
In jobs which contain a mixture of job-specific JCL and procedure calls, a job-specific step can refer back to a file which was fully specified in a procedure, for example:
DSN=*.STEP01.MYPR01.NEWFILE
means "use the file identified as NEWFILE
in step MYPR01
of the procedure used by step STEP01
of this job". Using the name of the step which called the procedure rather than the name of the procedure allows a programmer to use the same procedure several times in the same job without confusion about which instance of the procedure is used in the referback.
Comments
JCL files can be long and complex, and the language is not easy to read. OS JCL allows programmers to include two types of explanatory comment: *On the same line as a JCL statement. They can be extended by placing a continuation character (conventionally "X
") in column 72, followed by "//
" in columns 1–3 of the next line.
*Lines which contain only comment, often used to explain major points about the overall structure of the JCL rather than local details. Comment-only lines are also used to divide long, complex JCL files into sections.
Concatenating input files
OS JCL allows programmers to concatenate ("chain") input files so that they appear to the program as ''one'' file, for exampleConditional processing
OS expects programs to set a return code which specifies how successful the ''program'' thought it was. The most common conventional values are: *0 = Normal - all OK *4 = Warning - minor errors or problems *8 = Error - significant errors or problems *12 = Severe error - major errors or problems, the results (e.g. files or reports produced) should not be trusted. *16 = Terminal error - very serious problems, do not use the results! OS JCL refers to the return code asCOND
("condition code"), and can use it to decide whether to run subsequent steps. However, unlike most modern programming languages, conditional steps in OS JCL are ''not'' executed if the specified condition is true—thus giving rise to the STEP01
, and collect its return code.
# Don't run STEP02
if the number 4 is greater than STEP01
's return code.
# Don't run STEP03
if the number 8 is less than or equal to any previous return code.
# Run STEP04
only if STEP01
abnormally ended.
# Run STEP05
, even if STEP03
abnormally ended.
This translates to the following pseudocode:
run STEP01
if STEP01's return code is greater than or equal to 4 then
run STEP02
end if
if any previous return code is less than 8 then
run STEP03
end if
if STEP01 abnormally ended then
run STEP04
end if
if STEP03 abnormally ended then
run STEP05
else
run STEP05
end if
Note that by reading the steps containing COND
statements backwards, one can understand them fairly easily. This is an example of logical transposition.
However, IBM later introduced IF condition in JCL thereby making coding somewhat easier for programmers while retaining the COND
parameter (to avoid making changes to the existing JCLs where is used).
The COND
parameter may also be specified on the JOB
statement. If so the system "performs the same return code tests for every step in a job. If a JOB statement return code test is satisfied, the job terminates."
Utilities
Jobs use a number of IBM utility programs to assist in the processing of data. Utilities are most useful in batch processing. The utilities can be grouped into three sets: * Data Set Utilities - Create, print, copy, move and delete data sets. * System Utilities - Maintain and manage catalogs and other system information. * Access Method Services - Process Virtual Storage Access Method (VSAM) and non-VSAM data sets.Difficulty of use
OS JCL is undeniably complex and has been described as "user hostile". As one instructional book on JCL asked, "Why do even sophisticated programmers hesitate when it comes to Job Control Language?" The book stated that many programmers either copied control cards without really understanding what they did, or "believed the prevalent rumors that JCL was horrible, and only 'die-hard' computer-types ever understood it" and handed the task of figuring out the JCL statements to someone else.Ashley and Fernandez, ''Job Control Language'', pp. vii–viii, back cover. Such an attitude could be found in programming language textbooks, which preferred to focus on the language itself and not how programs in it were run. As one Fortran IV textbook said when listing possible error messages from theJob Entry Control Language
On IBM mainframe systems ''Job Entry Control Language'' or ''JECL'' is the set of command language control statements that provide information for the spooling subsystem – JES2 or JES3 on z/OS or VSE/POWER for z/VSE. JECL statements may "specify on which network computer to run the job, when to run the job, and where to send the resulting output." JECL is distinct from job control language (JCL), which instructs theOS/360
An early version of Job Entry Control Language for OS/360 Remote Job Entry (Program Number 360S-RC-536) used the identifier..
in columns 1–2 of the input record and consisted of a single control statement: JED
(Job Entry Definition). "Workstation Commands" such as LOGON
, LOGOFF
, and STATUS
also began with ..
.
pre-JES JECL
Although the term had not yet been developed, HASP did have similar functionality to what would become the JECL of JES, including/*
syntax.
z/OS
For JES2 JECL statements start with/*
, for JES3 they start with //*
, except for remote /*SIGNON
and /*SIGNOFF
commands. The commands for the two systems are completely different.
JES2 JECL
The following JES2 JECL statements are used in z/OS 1.2.0.JES3 JECL
The following JES3 JECL statements are used in z/OS 1.2.0z/VSE
For VSE JECL statements start with '* $$
' (note the ''single'' space). The Job Entry Control Language defines the start and end lines of JCL jobs. It advises VSE/ POWER how this job is handled. JECL statements define the job name (used by VSE/POWER), the class in which the job is processed, and the disposition of the job (i.e. D
, L
, K
, H
).
Example:
Other systems
Other mainframe batch systems had some form of job control language, whether called that or not; their syntax was completely different from IBM versions, but they usually provided similar capabilities. Interactive systems include " command languages"—command files (such as PCDOS ".bat" files) can be run non-interactively, but these usually do not provide as robust an environment for running unattended jobs as JCL. On some computer systems the job control language and the interactive command language may be different. For example, TSO on z/OS systems uses CLIST or Rexx as command languages along with JCL for batch work. On other systems these may be the same.See also
* dd (Unix), Unix program inspired byDD
* IBM mainframe utility programs
* References
Sources
* * * * * * * * * * {{Authority control Scripting languages Job scheduling IBM mainframe operating systems