JCL Training (7 Days)
JCL Training (7 Days)
JCL Training (7 Days)
CONTENTS
Data Organization
JCL Introduction
JCL JOB statement
JCL EXEC statement
dJCL DD statement
Introduction
Language we use to
Control the execution of
d
What is JCL
JCL Contd.
Accounting information
Which program to execute
Sequence of execution
Dataset required
Hardware required
//
JOB
//
EXEC
//
DD
JCL STATEMENT
JOB STATEMENT
EXEC STATEMENT
jobs running under control of JES, BATCH jobs. Many people who
have been working with computers for a long time often call the
JCL-statements, JCL-cards and the statements still have the same
size as a punched card, 80 positions.
One JCL
d statement is one row on the terminal screen
The most common JCL statements/ cards are:
JOB statement
EXEC statement(Execution)
DD statement (Data definition)
JCL PROCESSORS
INPUT
CONVERSION
SYS.PROCLIB
EXECUTION
OUTPUT
PRINT/
PURGE
PUNCH
SPOOL
INTERNAL
READER
PRINTER
LOCAL
READER
CARD PUNCH
I/P Q
RJE
JOB
Q
O/P
Q
RJE
JES PROCESSORS
INPUT
This is the process where a job will enter the system and is
given a number. The JOB ID number which will be id of the job as
long as it is in the system. The accounting information in the job
card is tested and any JES commands area executed. The JCL
statements are put on the SPOOL dataset in the input queue.
CONVERSION
d
In this process the JCL information from the input queue is
transformed into internal text and is tested for syntax errors. If a
procedure was called, it will get it from SYS1.PROCLIB and the JCL
will be expanded using the procedure. The results are put on the
JOB QUEUE.
JES PROCESSORS
EXECUTION
The internal text for the job is read into an initiator and the job
will execute.
OUTPUT
Here the result will be formatted according to the job class or
the statements in the job. The results are out on the specified
output queue.
PRINT/PUNCH
dThis is the process that helps you to get hold of the output. It
could be printed on a local printer, or send to a remote printer or
even another system.
PURGE
When all the results of the job are printed it is time for a clean
up. The purge process will help us to do that and it will release the
JOB ID that is generated when the job entered the system.
JOB SELECTION
CHECK POINT
JOB QUEUE
MVS
JES
INIT 1
INIT 2
JOB
CLASSES
A, Z,B,C
JOB
JOB
CLASSES CLASSES
S,B,A
C,Z
CLASS
Z
C
Z
T
A
B
JOB
14
145
146
1078
2001
2002
INIT 3
CLASS
2001
CLASS
2002
CLASS
145
CLASS
14
146
CLASS
1078
A
B
C
Z
T
JOB SELECTION
Batch jobs run in initiator address spaces and those can be started
to serve different job classes.
One initiator can be started with several job classes, they are
selected in priority order, in accordance with the class definition of
the initiator when it was started.
When an initiator is idle, it request work from JES address space.
d will look at the queue and select the highest priority job
JES then
for this initiator.
JOBLIB STEPLIB
SYS1.LINKLIB
(LNKLSTxx)
ABEND 806
IDENTIFIER
NAME FIELD
OPERATION FIELD
PARAMETER FIELD
JOB
//JNAME
d
//
//STEP1
//SYSIN
//SYSPRINT
EXEC
DD
DD
IDENTIFIER FIELD
NAME FIELD
OPERATION FIELD
dPARAMETER FIELD
COMMENT FIELD
col 1
JCL
/*
//*
//
//TSOI0XXA
JOB
//#STEP1
EXEC .
//INDATA
DD
//#STEP1
EXEC .
//INDATA
DD
//IFTEST
IF
//LIB d
JCLLIB
JOB
//TSOI0XXA
JOB D69A,DOE,MSGCLASS=A
//#STEP1
EXEC PGM=SORT
//INDATA
DD DSN=USERID.NEW.DATA,DISP=SHR
//TSOI0XXA
EXEC PGM=SORT
STEP 1
//INDATA
//#STEP1
71
//NAME
OPERATION PARAMETER,
//
PARAMETER,PARAMETER
//OUTDATA
DD DSN=USERID.NEW.DATA,
//
DISP=(NEW,CATLG),UNIT=SYSDA,SPACE=(TRK,(1,1)),
//
DCB=(LRECL=80,RECFM=FB,BLKSIZE=6160)
71 72
C
POS
12
/ /STEP1 EXEC MYPROC THIS STATEMENT CALLS A
/ / PROCEDURE NAMED MYPROC
/ / * PROCEDURE
72
d
KEYWORD
PARAMETERS
must be after any positional parameters
can be any order with respect to one another
need not indicate absence of a keyword parameter
DISP=(,KEEP,KEEP)
DISP=(NEW,KEEP,KEEP)
DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)
DCB=(LRECL=80,RECFM=FB)
POSITIONAL AND KEYWORD PARAMETERS
KEYWORD PARAMETERS
must be after any positional parameters
can be any order with respect to one another
need not indicate absence of a keyword parameter
JOB STATEMENT
CLASS
NOTIFY
TYPRUN
PRTY
RESTART
REGION
ACCT FIELD
PGMER NAME
MSGLEVEL
MSGCLASS
COND
USER
//JOBNAME JOB .
d
JOB STATEMENT
makes the beginning of the job and tells the system how to
process the job.
required and must be the first statement in each job
consists of // in the columns 1 and 2 and may have 4 fields
name(jobname), operation(job), parameter(positional and
keyword) and comments.
JOB STATEMENT
DEPT56A,DOE,
D86,C3,C THOMSON,.
(D/23,H124),JDOE,
DEPT56B.ODONNELL,.
//RUNA
//RUNB
//RUNC
//RUND
d
Positional
parameters on the JOB CARD
ACCOUNTING INFORMATION
Provides accounting information that installation requires
PROGRAMMERSS NAME
Identifies the person or group responsible for that job
JOB STATEMENT
x is 0 through 2
y is 0 and 1
x = 0 List job statement only
x = 1 List all user JCL plus all catalogued JCL
x = 2 List all user JCL but no catalogued JCL
y = 0 No initiator/terminator messages to be listed
y = 1 All initiator/terminator messages to be listed
Contd
MSGCLASS
Assigns the job log to an output class
MSGCLASS=n where
n is A through Z or 0 through 9
CLASS
Assigns the job to a class
CLASS=n where n is
A through Z or 0 through 9
dNOTIFY
Syntax
Syntax
JOB STATEMENT
Requests that the system send a message to the TSO userid specified
when the job completes processing
NOTIFY=userid where userid is
1 through 7 alphanumeric characters and must be a valid userid
Syntax
JOB STATEMENT
TYPRUN
Used to request special job processing
Syntax
TYPRUN=(SCAN/HOLD)
SCAN
Requests that the system scan this jobs JCL for syntax
errors, without executing the job or allocating any devices. This parameter
asks the system to check for:
HOLD
Request that the system hold the job before execution.
However JCL processing is performed and the job will not be held if an error
occurs.
JOB STATEMENT
TIME
Syntax
TIME=NOLIMIT
NOLIMIT specifies that the job can use the processor for an unlimited
damount of time. NOLIMIT is same as that of TIME=1440
TIME=MAXIMUM
MAXIMUM specifies that the step can use the processor for the
maximum amount of time. Allows the job to run for 357912 minutes.
JOB STATEMENT
RESTART
Syntax
RESTART=Stepname
Example.
//JOBNAME JOB ,RESTART=STEP3
Here the job start from the stepname STEP3 by passing the steps prior to the
step STEP3.
JOB STATEMENT
PRTY
Syntax
Within a JES2 job class or a JES3 job class group, the system selects
jobs for execution in order by priority. The higher the priority number,
the
sooner the job is selected. Jobs with the same priority are selected
on a
first-in first-out basis.
//jobname JOB acct,progname,PRTY=x
In a JES2 system, there are a number of factors that determine the order in
which a particular job is selected for execution. Therefore, you cannot be
assured that job priority (based on the PRTY you assign a job) or the order of
job submission will guarantee that the jobs will execute in a particular order.
JOB STATEMENT
USER
The USER parameter can be coded on the JOB statement to identify the
person submitting the job.
//TSO004J
Example
REGION
JOB STATEMENT
RESTART
Syntax
RESTART=Stepname
Example.
//JOBNAME JOB ,RESTART=STEP3
Here the job start from the stepname STEP3 by passing the steps prior to the
step STEP3.
//C1
COMMAND
//C2
71
S RMT1
16
COMMAND Specifies an MVS or JES2 command that the system issues when
the submitted JCL is converted.
Can appear anywhere in the job after the JOB statement
d of // in 1 and 2 column and may have 4 fields
Consists
Name(optional)
Operation(COMMAND)
Parameter (the parameter field specifies the name of the command, at
least one blank, and then the operands for the command, all enclosed in
apostrophes)
Comments(optional)
1.
10.12.39 JOB 8123 IEF452I JOBFAIL JOB NOT RUN - JCL ERROR
d
-----------------JES2 JOB STATISTICS ---------------6 CARDS READ
.
.
STMT NO
MESSAGE
1
IEF6301 UNIDENTIFIED KEYWORD CLAS
EXEC STATEMENT
COND
DPRTY
DYNAMNBR
PARM
PERFORM
RD
REGION
TIME
PGM=
PROC=
PROCNAME
//STEPNAME EXEC ..
ACCT
ADDRSPC
EXEC STATEMENT
Each job step begins with an EXEC statement that either names the
dprogram to execute or invoke a catalogued or in-stream procedure
Required for each job step
Maximum of 255 job steps
Consists of // in columns 1 and 2 and may have four fields
Name(stepname)
Operation(EXEC)
Parameter (positional and keyword)
comments
EXEC STATEMENT
//STEPNAME
//STEPNAME
//STEPNAME
dPROGRAM NAME
PROCEDURE NAME
Identifies the procedure to be called and executed.
EXEC STATEMENT
//STEP2
EXEC PGM=TEST,
//RUNA JOB .
// COND=(4,EQ,STEP1),REGION=10M,
// TIME=(,30),PERFORM=60,PARM=T1,
// DPRTY=(15,15),ACCT=(acct info.),
// DYNAMNBR=10,RD=NC,ADDRSPC=REAL
EXEC STATEMENT
ACCT
EXEC STATEMENT
ADDRSPC
ADDRSPC indicates type of storage for this step only, virtual or
real. This parameter cannot override a specific ADDRSPC coded on the
job statement, but may override the system default. If ADDRSPC needs
to be overridden for a given step of a called procedure this can be
done by the inclusion of a procstepname parameter.
d
VIRT:
ADDRSPC[.procstepame]={VIRT/REAL}
Syntax:
EXEC STATEMENT
COND
COND specifies return code test used to determine if this step is
to be executed or bypassed. The format of the COND in the EXEC
statement is similar to that of JOB statement, except a stepname is
used for referral purpose. If any of the test is true the step is bypassed,
only if none of the tests are true then the step is executed as normal.
Syntax
COND[.procstepname]=(code,operator[,stepname])
CODE: Specifies a number that the system compares to the
return codes from all previous steps in the job or from the specific
steps. Code a decimal number from 0 through 4095.
OPERATOR: Specifies the type of comparison to be made to the
return code. If the specified step is true the step is bypassed.
GE
NE
LE
EXEC STATEMENT
DPRTY
Assigns a dispatching priority for the address space for this step.
Syntax
DPRTY[.procstepname]=([val1][,val2])
You can omit the parenthesis if you code only val1
You must include the parenthesis and code a comma before val2 if you
code only val2
0 through 15
0 through 15
val1
val2
Note:
EXEC STATEMENT
DYNAMNBR
EXEC STATEMENT
PARM
Syntax
Length:
The entire information passed must not exceed 100
characters including any commas which are passed to the
processing
program, but excluding any enclosing parenthesis or
apostrophes.
Eg.
EXEC STATEMENT
PERFORM
Specifies performance group used by this step. The installationdefined performance group determine the rate at which the associated
steps have access to the processor, storage, and channels.
Syntax
PERFORM[.procstepname]=n where
EXEC STATEMENT
RD
Syntax
EXEC STATEMENT
REGION
Specifies the amount of storage in megabytes or kilobytes this step can
use.
Syntax
REGION[.procstepname]=(valK,valM)
EXEC STATEMENT
TIME
Use the TIME parameter to specify the maximum length of time that a job
step is to use the processor and to find out through messages how much
processor time the step used.
A step that exceeds its allotted time abnormally terminates and causes
job termination, unless an installation exit routine extends the time for the job.
TIME[.procstepname]={([minutes][,seconds])}
{1440
}
{NOLIMIT
}
{MAXIMUM
}
Minutes - The valid range of minutes is 1 through 357912(248.55 days)
dSeconds - The valid range of seconds is 1 through 59
1440
- Indicates that the step can use the processor for an
unlimited
amount of time; 1440 literally means 24 hours. Coding
TIME=1440
is same as coding as TIME=NOLIMIT
NOLIMIT specifies that the job can use the processor for an unlimited
amount of time. NOLIMIT is same as that of TIME=1440
MAXIMUM specifies that the step can use the processor for the
maximum amount of time. Allows the job to run for 357912
minutes.
Syntax
//[name]
IF [(] relational-expression[)] THEN
.
.
action when relational expression is true
//[name]
ELSE
.
.
action when relational expression is false
.
//[name]
ENDIF
Then THEN clause specifies the job steps that the system
process when the evaluation of the relational expression for the IF
statement is true.
The ELSE clause specifies the job steps that the system process
when the evaluation of the relational expression is false.
Contd ..
Name(optional)
Operation(IF,ELSE or ENDIF)
The relational expression field
The relational expression follows the IF operation field after at least one
intervening blank and is followed by at least one blank before the
characters THEN.
E.g. d
//
IF RC>4 THEN
IF (RC>4) THEN
Contd..
//JOBNAME
JOB
//STEP1 EXEC PGM=UPDATE
//.
//..
//STEP2 EXEC PGM=ADD
//
//..
//IFTEST IF (STEP1.RC>4 & STEP2.RC<8) THEN
//STEP3 EXEC PGM=.
//
d
//
ELSE
//STEP4
EXEC PGM=
//
//
//IFTEST ENDIF
Comparison operators
Logical operators
NOT(^) operators
Relational expression keywords
Logical
d operator
AND or
&
OR or
|
NOT operator
NOT or
Comparison operator
GT or
>
LT
or
<
NG or
^>
NL
or
^<
EQ or
=
NE or
^=
GE or
>=
LE
or
<=
Evaluation of operators
NOT will be evaluated first followed by comparison operator and
finally logical operators
IF
COND=
TRUE
BYPASS
IF
COND=
FALSE
EXECUTE
COND:
Involves testing condition codes from previous job steps to
determine flow of execution(whether or not to execute a program)
If the specified condition is true the step is bypassed
Condition may range from 0 to 4095
Condition code are specified on the COND= parameter
As coded on the EXEC statement.
//STEP1 EXEC PGM=TEST,COND=(4,LE)
Syntax
d
COND=((number,comparison{,stepname}),)
Stepname default to any previous step
Up to 8 conditions may be coded on one COND= parameter
Can be coded on job statement and overrides all condition on EXEC
statements.
//JOBNAME JOB ..,COND=(4,LE)
d
COND=EVEN
Execute even if the previous step end abnormally
COND=ONLY
Execute only if previous step ends abnormally
LAB Problem
JCL exercise
1.
Call the program IEFBR14 for this step called STEP1, passing the
following information, JANUARY 1 2007 EXAMPLES, the step
should take no longer than 10 seconds.
2.
STEP2 calls the program IEBUPDTE, passing it the option MOD,
but this run you should ensure this step is bypassed,(use COND= )
3.
The third and final step, STEP3 should invoke the program
IRTNOG.
Using the IF statement only run this step if STEP1 runs
d
OK.
4.
Finally this job should use no more than 2 minutes of CPU time,
but if any step in the job sets a return code of 99, then the job
should terminate,(use COND= )
*
DATA
DUMMY
DD .
DSN
DISP
UNIT
VOL
SPACE
LABEL
DCB
SYSOUT
//DDNAME
//INDATA
in-stream data set follows that contains no JCL and end of instream data set is indicated with // or /* or as specified on the DD *
statement DLM= parameter
DATA
in-stream data set follows that can contain JCL and end of instream
data set must be indicated with /* or as specified on the DD
d
DATA statement.
DUMMY
all I/O operations to be bypassed, and device allocation, space
allocation, and data set disposition to be ignored.
//SYSUT2
DD DSN=OUTTAPE,
//
DISP=(,CATLG),UNIT=TAPE
//
VOL=SER=TAPE01,
//
LABEL=(,NSL,RETPD=99365)
//SYSUT2
DD DSN=OUTDATA,
//
DISP=(,CATLG),UNIT=SYSADA,
//
VOL=SER=ZTSO01,SPACE=(TRK,(1,1,2)),
//
DCB=(LRECL=80,BLKSIZE=800,RECFM=FB)
//SYSOUT
DD SYSOUT=*
SPACE
Used to request space for a new dataset on a direct access
dvolume
VOL or
Identify the volume or volumes on which a data set
VOLUME resides or will reside
DCB
Provides the information to complete the data control
block(DCB) during execution
SYSOUT
Used to identify this data set as a system output dataset,
usually called sysout data set
DSN=MYDATA.OUTPUT,DISP=SHR
DSN=TESTDATA,DISP=SHR
DSN=TSO001.INPUT.DATA,DISP=SHR
DNS=TSO001.INPUT1.DATA DSN,DISP=SHR
//PRINT
//DD1
//SYSUT1
//
Consists of 1 to 8 characters
The first character must be alphabetic or a national(@,$,#)
DD
DD
DD
DD
DSN=A1234567,..
DSN=$ABC,..
DSN=A,..
DSN=#ABX56,.
Examples:
d//DD1
//DD2
//DD3
//DD4
Examples:
//DDA
//DDB
DD
DD
DSN=TSO001.DATA.INPT,..
DSN=DSRC012.ABC.DATA.INPUT,..
There are two ways to specify a temporary data set name on the DD
statement:
Code the DSN parameter using two ampersands(&&)
Omit the DSN parameter from the DD statement in which case the
system will assign a name
Examples:
//DD1
//STEPB
DD
DD
DSN=&&SORTOUT,..
DSN=&&TEMP(MEM1),..
A data set name can be referenced after its first use in the job. To
reference a data set name, refer to an earlier DD statement that
identifies the data set.
Example:
//DD1
//DD2
DD DSN=*.STEP1.INPUT,.
DD DSN=*.DD1,.
UNIT PARAMETER
UNIT=(DEV ADDRESS, UNIT COUNT, DEFER)
DEV TYPE
GROUP NAME
DEVICE ADDRESS:
DEVICE TYPE:
Request a device by its generic name which in an IBM supplied name
GROUP NAME:
Requests
a group of devices a symbolic name which is assigned by the
d
installation at system generation or IBM supplied
UNIT COUNT:
Specifies the number of devices for the data set
DEFER
Request that the volume(s) not be mounted until the data set is open
AFFINITY
Requests that the system allocate different data sets residing on
different removable volumes to the same device during the
execution of the step
Examples of UNIT parameter
//DD1 DD DSN=MYDS.DATA,DISP=OLD,UNIT=SYSDA
d DSN=ENTRY.JCL,DISP=SHR,UNIT=TAPE,.
//DD2 DD
//DD3 DD DSN=ABC.DEF,DISP=SHR,UNIT=328,.
//DD4 DD DSN=GRP.DATA,DISP=SHR,UNIT=(3420,,DEFER),.
//DD5 DD DSN=ABC.DEF,DISP=(,CATLG),UNIT=AFF=DDY,.