JCL Training (7 Days)

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 78

C

CONTENTS

Data Organization
JCL Introduction
JCL JOB statement
JCL EXEC statement

dJCL DD statement

Introduction

JCL stand for JOB CONTROL LANGUAGE

Language we use to
Control the execution of
d

Jobs in the system


Describing the job

Calling the program

Describing the resources eg. Datasets.

What is JCL

JCL Contd.

Accounting information
Which program to execute

JCL Defines the requirements of a job to the operating system

Sequence of execution

Dataset required
Hardware required

Direction (what is to be done)

//

JOB

//

EXEC

//

DD

JCL STATEMENT

JOB STATEMENT

EXEC STATEMENT

Gives the name of the job and supplies accounting information


Calls the specified program or procedure
DD STATEMENT

Describes the resources the program needs

JCL STATEMENT HISTORY

Job Control statements used to be punched onto cards. These cards


were read into the system from a local card reader.
The cards needed for one job is called a batch. This is why we call the

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

Simultaneous Peripheral Operation Online

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.

PROGRAM MANAGEMENT SEARCH SEQUENCE

JOBLIB STEPLIB

FIXED LINK PACK


AREA(FLPA)

MODIFIED LINK PACK


AREA(MLPA)

PAGABLE LINK PACK AREA


(PLPA)

JOB PACK AREA

SYS1.LINKLIB
(LNKLSTxx)

ABEND 806

JCL PARAMETER FIELDS

IDENTIFIER
NAME FIELD
OPERATION FIELD

PARAMETER FIELD

JOB

(ACCOUNT NR),PROG NAME,


NOTIFY=USERID
PGM=TEST
DSN=USERID.XX.DATA,DISP=SHR
SYSOUT=*

//JNAME
d
//
//STEP1
//SYSIN
//SYSPRINT

EXEC
DD
DD

JCL PARAMETER FIELDS

Each job control statement is logically divided into the following


five fields

IDENTIFIER FIELD
NAME FIELD
OPERATION FIELD
dPARAMETER FIELD
COMMENT FIELD

JCL- IDENTIFIER FIELD

col 1
JCL

/*

DELIMITER or JES2 CONTROL STATEMENTS

//*

COMMENT or JES3 CONTROL STATEMENTS

//

The identifier field indicate to the system that a statement is a


JCL statement, delimiter statement or a comment statement.

//TSOI0XXA

JOB

//#STEP1

EXEC .

//INDATA

DD

JCL statement NAME FIELD

The NAME FIELD identifies a control statement that other


statements and the system can reference
d
must begin in column 3
1 to 8 alphanumeric(A-Z, 0 9) or national characters($,@, #)
first character must be alphabetic or national
name field must be followed by at least one blank

//#STEP1

EXEC .

//INDATA

DD

//IFTEST

IF

//LIB d

JCLLIB

JOB

//TSOI0XXA

JCL statement OPERATION FIELD

The OPERATION FIELD specifies the type of control statement that


follows the name field
must be preceded and followed by at least one blank
can contain JOB, EXEC, DD, JCLLIB, COMMAND, IF etc

JCL statement PARAMETER FIELD

JOB D69A,DOE,MSGCLASS=A

//#STEP1

EXEC PGM=SORT

//INDATA

DD DSN=USERID.NEW.DATA,DISP=SHR

//TSOI0XXA

The PARAMETER FIELD contain one or more parameters separated


by commas
d
follows the operation field
NO blank between parameters
use commas to separate parameters
preceded and followed by at least one blank
parameters can be coded up to position 71

JCL statement COMMENT FIELD

EXEC PGM=SORT

STEP 1

//INDATA

DD DSN=USERID.NEW.DATA,DISP=SHR INPUT DATA

//#STEP1

The COMMENT FIELD contain information you find helpful when


you code the JCL statement.
dmust follow the parameter field
must be preceded by at least one blank
can be coded up to position 80
must not be used unless there is a parameter field

JCL statement CONTINUATION OF STATEMENT

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)

d Interrupt the field after a complete parameter or subparameter

including the comma that follows, at or before column 71.


Code // in the column 1 and 2 of the following statement.
Continuation can start from column 4 through 16.

JCL statement CONTINUING THE COMMENT FIELD

71 72
C

POS
12
/ /STEP1 EXEC MYPROC THIS STATEMENT CALLS A
/ / PROCEDURE NAMED MYPROC
/ / * PROCEDURE

72

Interrupt the comment at a convenient place before column

Code non blank character in column 72


Code / / in column 1 and 2 of the following statement
Continue the comment field beginning in any column after
column 3
Note: THE COMMENT STATEMENT CAN NOT BE CONTINUED!

//NAME OPERATION P1,P2,P3,K1=A


//NAME OPERATION ,P2,P3,K1=A
//NAME OPERATION P1,K1=A,K2=B
//NAME OPERATION K1=A,K3=C,K2=B

JCL statement POSITIONAL PARAMETERS

The POSITIONAL PARAMETERS


must be first
must be in a specific order
dabsence must be indicated by a comma
if the last one is absent, no comma necessary
if all are absent, no comma is necessary.
Eg.
TIME=(5,0) = TIME=(5) = TIME=5
TIME=(0,30) = TIME=(,30) = TIME=(30) = TIME=30

JCL statement KEYWORD PARAMETERS

//NAME OPERATION P1,K2=B

//NAME OPERATION K1=A,K2=B,K3=C

//NAME OPERATION ,P2,K2=B,K1=A

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

JCL statement POSITIONAL AND


KEYWORD SUBPARAMETERS
DISP=OLD

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

POSITIONAL PARAMETERS ON THE JOB STATEMENT


JOB
JOB
JOB
JOB

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

KEYWORD PARAMETERS ON THE JOB STATEMENT

//RUNA JOB DEPT54A,DAVIS,MSGLEVEL=(1,1),MSGCLASS=A,


//
CLASS=A,NOTIFY=TSO003,TYPRUN=SCAN

The keyword parameters


MSGLEVEL
Specifies the printing of JCL statements and allocation messages
to the job log
d
Syntax
MSGLEVEL=(x,y) where

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:

Invalid spelling of parameter keywords and some sub-parameter


keywords
Invalid characters
dUnbalances parenthesis
Misplaced positional parameters on some statements
Invalid syntax on JCL statements in a catalogued procedure invoked by
any scanned EXEC statements

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

Specifies the maximum amount of time allowed for the job


TIME=(x,y) where
x for minutes and
y for seconds
The valid range of minutes is 1 through 357912(248.55 days)
The valid range of seconds is 1 through 59

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

Restart refers to the continuation of a previous aborted job stream

Restart parameter specifies the new starting step for a job

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

where n is an integer. The maximum value of n is 15.


Example.

d//JOB10 JOB ,'FLO JONES',PRTY=14


Note:

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

JOB ACCT15,SAM THOMAS',USER=ID32DBP

REGION

The amount of space needed by a job or step can be specified in the


REGION
d parameter of the JOB or EXEC statement. If REGION is on the JOB
statement, each step of the job executes in the requested amount of
space.
If on the EXEC statements in a job, each step executes in its own amount of
space. Use the EXEC statement REGION parameters when different steps need
greatly different amounts of space.
Example :
//J28 JOB ,'F. GOLAZESKI',CLASS=D,REGION=20K

JOB STATEMENT

RESTART
Syntax

RESTART=Stepname

Restart refers to the continuation of a previous aborted job stream

Restart parameter specifies the new starting step for a job

Example.
//JOBNAME JOB ,RESTART=STEP3

Here the job start from the stepname STEP3 by passing the steps prior to the
step STEP3.

JES2 CONTROL STATEMENT


//[Name]

COMMAND command command-operand

//C1

COMMAND

//C2

COMMAND SEND THE COMPLIE STEP IS NOW


COMPLETE , USER=TSO002

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)

JOB Statement Paper Exercise


Identify the following as valid or invalid examples of job names.
If invalid why?
//JOB13
//$ABCD
//RUN#3
//TEST#4567
//*RUN#5
//1@PAY011

Use the following information and code a job statement.


JOBNAME
ABC1
ACCOUNT#
D415
PGM.NAME
YOUNG
MESSAGE CLASS
E
PRINT ALL JCL STATEMENTS
PRINT
ALL MESSAGES
d

Use the following information and code a job statement


JOBNAME
ABC2
ACCOUNT#
677-67
PGM.NAME
M SMITH
MESSAGE CLASS
C
PRINT ONLY JOB STATEMENT
NO MESSAGES

1.

JOB Statement Paper Exercise

Use the following information and code a job statement.


JOBNAME
ABC3
ACCOUNT#
1828
PGM.NAME
WOODS
MESSAGE CLASS
D
NOTIFY
ABC
PRINT ALL JCL STATEMENTS
NO MESSAGES

Use the following information and code a job statement


d
JOBNAME
ABC4
ACCOUNT#
1762,45
PGM.NAME
YOUR NAME
MESSAGE CLASS
E
EXECUTION CLASS
A
NOTIFY
ABC

After submitting a job, go through the job log

JES JOB LOG

//RUN1 JOB 36PGT123,M SMITH,NOTIFY=TSO002,MSGCLASS=A,


// CLAS=A,MSGLEVEL=(1,1)
//STEP1 EXEC PGM=IEFBR14
//DD1
DD DSN=TSO002.NEW.DATA,DISP=(NEW,CATLG),
// SPACE=(TRK,(2,1,3)),LRECL=80,RECFM=FB,BLKSIZE=6160
//SYSPRINT DD SYSOUT=*
====================SPLIT SCREEN ===============================
JES JOB LOG -------SYSTEM K123 .

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

POSITIONAL PARAMETERS ON THE EXEC STATEMENT


EXEC PGM=IEFBR14
EXEC PROC=MYPROC
EXEC MYPROC

//STEPNAME
//STEPNAME
//STEPNAME

The positional parameters on the EXEC statement

dPROGRAM NAME

Provides the name of the program to be executed

PROCEDURE NAME
Identifies the procedure to be called and executed.

EXEC STATEMENT

KEYWORD PARAMETERS ON THE 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

Specifies accounting information for this step only. Any


information coded here overrides that coded on the job statement. If
accounting information needs to be overridden for a given step of a
called procedure this can be done by the inclusion of a procstepname
parameter.
Syntax=
ACCT[.procstepname]= accounting information. The
rule for coding the accounting information are identical to the
rules
for accounting information on the job statement.

A single parameter or a list of parameters separated by


commas and enclosed by parentheses.

No more than 142 characters including commas.


Apostrophes needed for special characters

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:

Request virtual storage. The system can page the step

REAL: Request real storage. The system cannot page the


job step and must place the job step in real storage

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.

The operators are


GT Greater than
EQ Equal to
LT
Less than

GE
NE
LE

Greater than or equal to


Not equal to
Less than or equal to

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

The system forms the internal dispatching priority as follows


dispatching priority= (val1 * 16 ) + val2

Note:

The DPRTY keyword is ignored in MVS V5 onwards. You can no longer


specify the DPRTY in JCL. All dispatching priorities are assigned in the
IEAIPSxx parmlib member.

EXEC STATEMENT

DYNAMNBR

Holds a number of data set allocations for reuse


Syntax
DYNAMNBR[.PROCSTEPNAME]=n where

n specifies a value used to calculate the number of data set allocations


that the system can hold in anticipation of reuse. The value of n can be up to
the maximum size of the TIOT(Task Input Output Table) control
block(0
through 3273), less the number of ddnames used in the calling
JCL.
Eg.
dA JCL job with 10 ddnames and a TIOT of 32k the DYNAMNBR would be
3273 minus 10, i.e. 3263

If no DYNAMNBR parameter is specified, the default is 0

EXEC STATEMENT

PARM

Syntax

Used to pass variable information to the processing program executed


by this job step.
PARM[.procstepname]=information

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.

If processing program expects either as apostrophe or an


ampersand as part of the passed information then code two
consecutive apostrophe or ampersand.
Code 123&4 as PARM=123&&4.

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

n requests a performance group, where n is a number


from 1 through 999 and must identify a performance group
d
identified by the installation.

EXEC STATEMENT
RD

Indicates whether the operator should perform automatic step


restart, if step fails.
RD[.PROCSTEPNAME]={R/RNC/NR/NC}

Syntax

RD=R (Restart, Checkpoints allowed) Indicates the operator is to


perform automatic step restart if the job step fails
RD=RNC (Restart, No Checkpoints) Indicates the operator is to
perform automatic restart, but from step start not from a checkpoint,
as
RNC actually suppresses any checkpoint facility requested within the called
d
program.
RD=NR (No automatic restart, checkpoints allowed) Indicates the
operator is not to perform automatic restart if the step fails.
However
checkpoints can be used for deferred restart.
RD=NC (No automatic restart, No checkpoints) Indicates the operator is
not to perform automatic restart if the step fails, and if deferred restart is used
then the job step must restart from the beginning as any
checkpoint facility
requested in the called program will be suppressed.

EXEC STATEMENT

REGION
Specifies the amount of storage in megabytes or kilobytes this step can

use.
Syntax

REGION[.procstepname]=(valK,valM)

valK: Specifies the required storage in Kilobytes. The value is 1


through 7 decimal numbers, from 1 through 2096128. Code an
even number.
If you code an odd number the system treats it as
the
d
next highest even number.

valM: Specifies the required storage in Megabytes. The value is 1


through 4 decimal numbers, from 1 through 2047. Code either
even number or odd number.

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

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

//[name]
IF [(] relational-expression[)] THEN
.
.
action when relational expression is true
//[name]
ELSE
.
.
action when relational expression is false
.
//[name]
ENDIF

The IF statement is always followed by a relational expression and a


THEN clause. Optionally, an ELSE clause can follow the THEN clause.
An ENDIF statement always follows the ELSE clause, if present, or the
THEN clause.
Contd..

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

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.

The system evaluates the relational expression at execution time.


The EDNIF statement indicates the end of the
IF/THEN/ELSE/ENDIF statement.

Contd ..

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

The IF/THEN/ELSE/ENDIF statement constructs up to a maximum of 15


levels.
Consists of // in columns 1 and 2 and may have following fields

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

You can enclose the relational expression in parenthesis.


//

IF (RC>4) THEN
Contd..

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

//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

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

A relational expression consists of

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
<=

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

Relational Expression Keywords

Evaluation of operators
NOT will be evaluated first followed by comparison operator and
finally logical operators

RC indicate a return keyword


ABEND indicate an abend condition occurred
^ABEND indicate no abend condition occurred
d
ABENDCC indicate a specific system or user abend code
RUN indicate that the specified step executed
^RUN indicate that the specified step did not execute

Operators on IF/THEN/ELSE/ENDIF Statement


Construct

RC indicates that the relational expression tests a return code. Evaluate


the return code by coding RC, a comparison operator, and a
numeric value.
E.g. (RC=8) test for a return code equal to 8
ABEND or ABEND= TRUE indicates that the relational expression tests
for an abend condition that occurred during processing of the job
prior to the time of evaluation.
^ABEND of ABEND=FALSE indicates that the relational expression test
d abend condition did not occur during the processing of the
that an
job prior to the time of evaluation.
ABENDCC=Sxxxx of ABENDCC=Uxxxx indicates the relational
expression tests for a system abend completion code (Sxxxx) or a
user defined abend completion code(Uxxxx).

CONDITIONAL EXECUTION OF JOB STEPS

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)

VALID COMPARIOSN OPERATORS for


COMD=parameters

Valid Comparison Operators(for COND=parameter)


GT Greater Than
GE Greater Than or Equal
EQ Equal
LT
Less Than
LE
Less Than or Equal
NE Not Equal

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

DD (Data Definition) STATEMENT

DD (Data Definition) statement


Describes a data set and specifies the input and output
resources needed for the dataset
d
Required for each dataset used
Consists of // in column 1 and 2 and may have 4 fields
name (ddname)
operation(DD)
parameters(positional and keyword)
comments

DD (Data Definition) STATEMENT

POSITIONAL PARAMETERS ON THE DD STATEMENT


DD *
,DLM=
.
DATA
.
instream data for input
.
.
d
//* or //*
or //
(end of data)
or two character demiliter
//INDATA DD DUMMY

//INDATA

DD (Data Definition) STATEMENT


POSITIONAL PARAMETERS ON THE DD STATEMENT

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.

DD (Data Definition) STATEMENT

KEYWORD PARAMETERS ON THE DD STATEMENT

//SYSUT2
DD DSN=OUTTAPE,
//
DISP=(,CATLG),UNIT=TAPE
//
VOL=SER=TAPE01,
//
LABEL=(,NSL,RETPD=99365)

DSN or DSNAME Specifies the name of the dataset


DISP
Specifies the status of the dataset to the system and
tells
d the system what to do with the dataset after termination of the
job step or job
UNIT
Tells the system to place the dataset on a specific
device, a certain type or group of devices, or the same device as an
other dataset
LABEL
Specifies the type of label, the relative file number n
the tape, and whether the data set is protected for input or output

DD (Data Definition) STATEMENT

KEYWORD PARAMETERS ON THE DD STATEMENT

//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

DDNAME FIELD ON THE DD STATEMENT


DD
DD
DD
DD

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
//

DD (Data Definition) STATEMENT

ddname should be unique within the job step


ddname is omitted if the DD statement defines a data set that is
concatenated
to the dataset of the preceding DD statement
d
programmer supplies a ddname in the program for each data set
to be used
Example.
COBOL
SELECT INFILE ASSIGN TO DD1
PL/I
READ FILE(PRINT)
ASSEMBLER
FILEIN DCB DDNAME=SYSUT1

DD (Data Definition) STATEMENT

RULES FOR CONCATENATION

Maximum of 255 sequential datasets


Maximum of 16 partitioned datasets
Partitioned and sequential dataset can not be mixed
Members
of partitioned datasets are considered as sequential
d
datasets
RECFM must be the same on each datasets being concatenated

DD (Data Definition) STATEMENT

DSNAME PARAMETER ON THE DD STATEMENT

The name of a dataset can be:


simple data set name
qualified data set name
partitioned data set name
d
temporary data set name
referenced from an earlier DD statement

DD (Data Definition) STATEMENT

SIMPLE DATASET NAME

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

DD (Data Definition) STATEMENT


QUALIFIED DATASET NAME

Consists of multiple data set names separated by periods

Each name within the qualified name can be 1 to 8 characters with


first an alphabetic or national

The entire qualified name can include as many as 44 characters


including
periods
d

Examples:
//DDA
//DDB

DD
DD

DSN=TSO001.DATA.INPT,..
DSN=DSRC012.ABC.DATA.INPUT,..

DD (Data Definition) STATEMENT

PARTITIONED DATASET NAME

Consists of a partitioned dataset name with a member name


enclosed in parenthesis
The partitioned data set name will follow the rules of the simple
data set name or qualified data set name
The member name can be 1 to 8 characters
The entire data set name can inclide as many as 44 characters
d
(excluding
the member name)
Examples:
//DD2
DD DSN=TSO001.INPUT.DATA(MEM1),..
//DD3
DD DSN=DSRC012.PAYROLL.DATA(TESTDATA),

DD (Data Definition) STATEMENT

TEMPORARY DATA SET NAME

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

A temporary data set can be specified as a partitioned data set


The
d entire data set name can be 1 to 8 characters (excluding the
member name)

Examples:
//DD1
//STEPB

DD
DD

DSN=&&SORTOUT,..
DSN=&&TEMP(MEM1),..

DD (Data Definition) STATEMENT


REFERENCE FROM A PREVIOUS DD STATEMENT

A referback is a reference to an earlier DD statement in the job or


in a catalogued or in-stream procedure called by a job step. A
referback is in the form of *.ddname or *.stepname.ddname or
*.stepname.procstepname.ddname.
Example 1
//TSO001B JOB ..
//STEP1
EXEC .
d//INPUT1 DD DSN=
//STEP2
EXEC .
//OUTPT
DD DSN=*.STEP1.INPUT1
Example 2
//OUTPUT1 DD DSN=TSO001.FILE,DCB=*.STEP1.INPT1

DD (Data Definition) STATEMENT


DATA SET REFERENCED FROM A PREVIOUS STEP

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.

1. Code DSNAME=*.stepname.ddname when the earlier DD


statement is contained in an earlier job step.
2. Code DSNAME=*.ddname when the earlier DD statement is
d
contained
in the same job step

Example:
//DD1
//DD2

DD DSN=*.STEP1.INPUT,.
DD DSN=*.DD1,.

DD (Data Definition) STATEMENT

DISP PARAMETER ON THE DD STATEMENT


INITIAL
NORMAL ABNORMAL
DISP =(NEW,
DELETE, DELETE )
OLD,
KEEP,
KEEP
SHR,
PASS,
CATLG
MOD,
CATLG
UNCATLG
UNCATLG
All sub parameters on within the DISP parameter are positional.
INITINAL STATUS is the status of the data set at the beginning of the
d
step
NORMAL TERMINATION indicates the disposition of the data set when
the job terminates normally
ABNORMAL TERMINATION indicates the disposition of the data set
when the job abnormally terminates.

DD (Data Definition) STATEMENT

UNIT PARAMETER
UNIT=(DEV ADDRESS, UNIT COUNT, DEFER)
DEV TYPE
GROUP NAME
DEVICE ADDRESS:

A 3-digit or 4-digit hexadecimal address of the device being requested

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

DD (Data Definition) STATEMENT

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,.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy