IBM JCL
|
Excerpted from Operating DOS/VSE in a VM Environment
by Frank Whittle |
Overview
In order to
communicate with the operating system, the programmer uses JCL (Job Control
Language). This language controls the Job Control Program (JCP) which is part of
the operating system. The Job Control Program is the programmer's link to the
operating system through which the operating system is informed of the various
requirements for a program to be executed. The instructions which comprise the
job control language are divided into two categories, Job Control Commands (JCC)
and Job Control Statements (JCS). Both of these categories will be explored
later on in this chapter. It is important to realize at this time that JCP is a
program and that JCL is the language with which a programmer or an operator can
communicate with the JCP. Depending upon the requirements of the program(s)
being processed, certain functions will be required of the operating system and
JCP will instruct the system to fulfill these functions as specified by the
programmer/operator.
In general, the programmer will supply JCS along with the
program and the operator will enter JCC from the operator's console depending
upon specific processing requirements. It is sufficient, at this time, to
differentiate JCS from JCC by stating that all JCS are of the following
form:
//boperation
Note that the first three columns of a JCS must contain
//b. Note that a blank space is represented as the symbol b. The operation will
be chosen depending upon the requirements of the program.
A JCC or Job Control Command differs from JCS in that the
operation is not preceded by a //b and therefore the operation will start in
column 1. The reader should be aware that certain operations will produce a
different result when entered as a JCC as opposed to a JCS. These differences
will be brought to the attention of the reader when the individual operations
are discussed.
Let us examine some of the available operations which can
be entered into the JCP. By examining a basic job, many important JCP operations
can be identified. A job is a unit of work delimited by a //bJOB statement and a
/&. A jobstream is composed of one or more jobs and a jobstep is a single
execution of a program within the jobstream. It should be noted that a job may,
and in most cases does, consist of multiple jobsteps. The following example is a
basic jobstream which will compile a COBOL source program, link-edit the
resultant object module ( which is the source program converted to machine code)
and execute the phase (which is an executable program obtained from the object
module after being processed by the linkage editor). The concept of a source
program, an object module and a phase may seem vague at this time but they will
be defined with more clarity shortly.
// JOB jobname
// OPTION LINK
// EXEC FCOBOL
source program
/*
// EXEC LNKEDT
// EXEC
data
/*
/&
The individual statements of the above job will be
discussed with special emphasis on the various JCP operations being
used.
A. The JOB statement:
//bJOBbjobname
The job statement will initiate a job and is always the
first statement in a jobstream. The JCP will read the jobname which is provided
by the user and store this name in the communication region of the supervisor.
If the name is not recorded on the job statement or recorded incorrectly, JCP
will default to storing the name NONAME in the communication region. The time of
entry into the system will also be recorded at this time in the communication
area. The jobname must be preceded and followed by a blank and must be from 1 to
8 alphnumeric characters in length.
B. The OPTION statement:
//bOPTIONboption1[,option2,option3...]
The option statement will specify one or more options to
the Job Control Program. The order of the options is arbitrary. Some of the
possible options which are available are:
LINK - indicates that the object module is to be
processed by the linkage editor program. The object module, which is the output
of the compiler, is therefore written to a place on the disk referred to as
SYSLNK.
DUMP - causes the register contents and the contents of
main storage to be printed upon abnormal termination of the application
program.
DECK - the compiler will produce an object module on the
area on disk entitled SYSPCH (In the past, this area was associated with a card
punch machine.)
ERRS - the compiler will summarize all errors on SYSLST
(the printer).
CATAL - sets the link option and instructs the linkage
editor to catalog the resultant phase permanently on disk.
XREF - compiler will write a symbol cross-reference list
on SYSLST
LOG - lists the job control statements which are entered
by the programmer on SYSLST.
Other options are available and some of these will be
introduced in later chapters. If the programmer does not specify a particular
option, the JCP will default to a value. The option to which the JCP defaults is
called the default value which is determined by the system programmer at system
generation time.. Standard default options are: NOLINK, NODECK, LIST, ERRS,
XREF, NODUMP, NOCATAL, LOG. Notice that an option can be "turned off" by
preceding the option with a prefix of "NO". For example, if the programmer did
not want a listing but did want the DUMP option to be in effect he would
enter:
// OPTION NOLIST,DUMP
C. The EXECUTE statement:
//bEXECb[[PGM=programname][PROC=procedurename]][,SIZE=nK]
The execute signals the the end of job control
information for a jobstep and causes the specified program to be executed.
Therefore, all requirements of the program must be satisfied before the EXEC
statement is encountered. This statement will cause the supervisor to locate the
phase or procedure (set of JCL statements which have been stored on disk), load
the phase or procedure and execute it. The reader should be aware that the
keyword PGM is optional when executing a phase. If, however, the programmer
wishes to execute a procedure, she must specify the keyword PROC=. The concept
of a procedure will be discussed in detail in a future chapter. For the time
being, we will only concentrate on the execution of a phase. The execute
statement may also include a size parameter which will limit the available main
storage for execution. The size parameter would be entered after the phasename
and would have the form SIZE=nK. An example of the execute statement with a size
parameter is
//bEXEC NAME,SIZE=64K
which is equivalent to writing
//bEXEC PGM=NAME,SIZE=64K
Both statements will execute the phase entitled NAME
which is stored on disk and allow the program to execute within 64 thousand
bytes of main storage.
Specifically, the statement:
//bEXEC FCOBOL
will execute a phase called FCOBOL (the COBOL compiler)
from an area on disk called the CIL (Core Image Library). The compiler will read
source statements as entered by the programmer, compile the source program
(check for syntax and vocabulary errors) and write the resultant object module
onto SYSLNK. This process will be explained in more detail in Chapter
5.
The statement:
//bEXEC LNKEDT
will execute a phase called LNKEDT (the linkage editor
program) from the CIL. The linkage editor program will link-edit the object
module which is located on SYSLNK, creates a machine executable program called a
phase and places this phase into a temporary area in the core-image library.
This process will also be explained in more detail in Chapter 5.
The statement:
//bEXEC
will execute the phase located in the temporary area of
the CIL. This is the phase which was just produced by the linkage editor. Notice
that since no name was specified, the phase just previously created is
executed.
D. The End-of-Data statement:
/*
The end-of-data or end-of-jobstep operation signals
end-of-file condition (eof) which can be tested by the application program. The
reader should be aware that this statement is an exception to the standard
format of the JCS.
E. The End-of-Job statement:
/&
The end-of-job operation is a job delimiter and should be
placed at the conclusion of each job. It performs the following
functions:
a. reset all options to their default values as
determined at system generation time. The link and catal switches are reset to
zero (turned off).
b. resets all assignments of devices to default
values
c. stores NONAME in the name area of the communication
region of the supervisor
d. sets the UPSI byte in the supervisor to zero. This is
known as the User
Program Switch Indicator which can be tested by the
application program.
e. prints the time of day and the duration of the
job
The end-of-job-statement is also an exception to the
format of the standard Job Control Statement. If the programmer does not include
an end-of-job statement, JCP will create and end-of-job statement upon
encountering the next job statement.
Before concluding the discussion on this basic jobstream,
we will investigate the interface that occurs between the supervisor, JCP and
the application program during the processing of the job. If you feel
uncomfortable about the terms SYSLNK, SYSRDR, SYSIPT and SYSLST you may want to
read Chapter 3 before continuing.
The basic jobstream introduced
earlier in this chapter will be listed again and referred to in the following
discussion.
// JOB jobname
// OPTION LINK
// EXEC FCOBOL
source program
/*
// EXEC LNKEDT
// EXEC
data
/*
/&
During the IPL (Initial Program Load) of the system, the
supervisor was loaded into storage ( and remains in storage during the entire
"up" time) and a copy of JCP was also loaded into storage. When the jobstream
enters the computer for processing, the following occurs:
1. JCP reads the job statement from SYSRDR and stores the
jobname and the time of day in the communication region of the
supervisor.
2. JCP reads the option statement and sets the link
switch to "ON". This will cause the following to occur:
a. Instruct the compiler to output the object module to
SYSLNK.
b. Instruct the linkage editor to store the phase in the
temporary area of the CIL.
3. JCP reads //bEXEC FCOBOL and transfers the name FCOBOL
to the supervisor.
4. The supervisor loads the phase FCOBOL from the CIL and
overlays JCP in the process.
5. The compiler, FCOBOL, has control at this point and
reads the source statements from SYSIPT until encountering an end-of-data marker
(/*). The compiler will then output the object module to SYSLNK (as instructed
by the option statement).
6. The supervisor will load JCP into main computer
storage and in the process overlays the FCOBOL program.
7. JCP reads //bEXEC LNKEDT from SYSRDR and transfers the
name LNKEDT to the supervisor.
8. The supervisor loads in the phase entitled LNKEDT from
the CIL and once again overlays JCP.
9. The linkage editor reads the object module from
SYSLNK, link edits it and stores the resultant phase in the temporary area of
the CIL.
10. The supervisor regains control and loads in JCP
(overlaying LNKEDT).
11. JCP reads //bEXEC from SYSRDR and returns control to
the supervisor. Since no phase name was specified, JCP will pass the name
PHASE*** to the supervisor.
12. The supervisor will load the application phase
(PHASE***) from the CIL. This is the phase just created by the linkage
editor.
13. The application program will take control and in this
case read data from SYSIPT until encountering an end of data marker.
14. Upon completion of execution, the application program
will return control to the the supervisor which will load in JCP (overlaying the
application program).
15. JCP will read /& from SYSRDR and reset the link
option, store NONAME in the communication region and print the time of day and
duration time.
16. Job Control Program now awaits the next job to enter
the system.
SUMMARY
In this chapter, the reader was introduced to the
function of the Job Control Program and the language (JCL) with which the
programmer can communicate with the control program. A basic jobstream was
evaluated and various JCP operations were discussed in detail. Each statement
from the beginning of the job through the end of the job was detailed in terms
of form and function. The concept of a compiler and a linkage editor was
introduced and their functions were briefly described. The chapter concluded
with an in-depth discussion of the rather complex interactions between
compilers, link editors, application programs and the Job Control Program during
the execution of a relatively basic jobstream. After reading this chapter, the
reader should now be able to create and run a jobstream similar to the one
discussed and feel reasonably comfortable in defining the need for each of the
Job Control Statement in the job.
SELF TEST MATERIAL
1. Create a job which will compile, link-edit and execute
a program supplied by your instructor. Explain the function of each statement in
the jobstream.
2. State the difference between JCC, JCL, JCS and
JCP.
3. Explain the interactions which occur in main storage
during the execution of the basic job created in #1 above.
4. Define an object module.
5. List three options which can be specified on the
OPTION statement.