Você está na página 1de 81

Introduction

JOB CONTROL LANGUAGE


AGENDA FOR DAY 1

 JCL Introduction
 JOB Statement
 JOB Parameters ( Positional and Keyword )
What is JCL ?.

Question
What is JCL ?.

 JCL stands for JOB CONTROL LANGUAGE


 Provides a Mechanism to communicate the
requirements to execute a program, to the MVS
operating system.
 JCL consists of statements that provide specifications
to execute a JOB
JOB CONTROL LANGUAGE (JCL)

● JCL is a language which allows users to communicate with


the operating system

● JCL step tells the operating system

– Name, location of the application program to be


processed
– Name and location of the data files needed by the
application program
– Hardware devices needed by the application program
to achieve its function
Why we need JCL ?.

Question
Why we Need JCL ?.

 Job control language will identify all the resources


needed by the program to the MVS Operating system.
 You need to have JCL , If you want to run your
program in batch mode in a mainframe environment.
 Control serious of JOB executed in Mainframe
Environment
How JCL Works ?.

Question
HOW JCL WORKS ?.

 Every JCL coded has to be run; In Mainframe terminology, it is


called submitting the JCL; henceforth known as submitting the
JOB

 There is a subsystem in MVS called JES (short for Job Entry


Subsystem) that manages JOBS submitted to the system by
users

 JES

 Receives JOBS

 Schedules JOBS based on their priority

 Allocates resources to JOBS as they execute

 Processes output generated by JOBS


JES RESP
Structure of JCL

Overview
JOB CONTROL LANGUAGE
JOB STMNT
EXEC STMT
DD STATEMENT
STRUCTURE OF JCL

oVERVIEW
General Format of JCL Statement

 JCL Statements are coded as 80 bytes records and


are categorized into following fields:

 IDENTIFIER Field
 NAME Field
 OPERATION Field
 PARAMETER Field
 COMMENT Field
Basic Format for JCL Statement

Identifier
Name Field
Parameter Field
Operation Field

//P390B21R JOB 3612,’RAJESH’,NOTIFY=P390B21


//POST EXEC PGM=CM3000
//CUSTRAN DD DSN=P390B21.CUSTOMER.TRANS,DSP=SHR
//CUSTRAN DD DSN=P390B21.CUSTOMER.TRANS,DSP=SHR
//ERRLST DD SYSOUT=*
Question and Answers

Overview
JOB STATEMENT

Overview
What is JOB
STATEMENT ?.

Question
CODING RULES FOR
JOB STATEMENT

Overview
Coding Rules for of Job Statement
Example: Coding Rules for of Job
Statement
Coding Rules for of Job Statement for
Operation Field
Coding Rules for of Job Statement
JCL Field Definition Rules

 PARAMETER fields follow OPERATION field and


separated by commas
 COMMENT field
 Follows parameter field and can contain any
details
 Must be preceded by one blank
 Can be entered in all lines
Coding Rule for Parameter Field
Coding Rules for Parameter Field
Parameter Fields

Parameter fields are of two types – Positional and Keyword


Parameters
 Positional Parameters
 Should be coded in a specific sequence
 Separated by commas
 Omitted parameters indicated by a comma to indicate the
positional nature
 Keyword Parameters
 No specific sequence and can be coded in any order
 Format is parm=<value>
 Separated by commas
 Follow positional parameters
 Can be omitted altogether if required
Position and Keyword Parameters
Coding Rules for Positional Parameter
Coding Rules for Keyword Parameter(1)
Coding Rules for Comment field
Coding Rules for Comment Field
JOB STATEMENT
 JOB statement identifies the
JOB to the system

 JOB Statement consists of


 JOBNAME
 JOB operator
 Positional Parameters
 Accounting Info
 Programmer
NAME

 Keyword Parameters
 MSGCLASS
 CLASS
 MSGLEVEL
 NOTIFY
 REGION
 TIME
 PRTY
 COND
 RESTART
 TYPRUN
JOB NAME

 Starts in column 3
following the identifier
field

 Should be between 1 to
8 characters

 First character should be


Alphabetic and not a
Number

 Should be followed by a
space
JOB Operator
 Preceded and
succeeded by a blank
space
Positional Parameters

 JOB statement consists of two positional parameters

 Job Accounting Information

 Programmer name
Accounting Information

 Identifies the Account number to the


system to track the CPU time used by
JCL the JOB
 Has two positional sub parameters –
Account number and Additional
Accounting info
MVS  Format is (<account-number>,
<additional-accounting-info>)
JES ACCOUNT  Format is installation dependent
 Within accounting info,
ACCT#, CPU Time
 If only <account-number> is
specified, then parantheses can be
omitted
 If only <additional-accounting-info>
CPU is specified, then the absence of
<account-number> is specified by a
comma to indicate the positional
nature of the subAccount 1
parameters

BILL Account 2
Accounting Information - Examples
KEYWORD
PARAMETERS

Overview
Keyword Parameters

 Keyword parameters follow positional parameters and can be in any order


 Some of the keyword parameters used in the JOB statement are
 CLASS
 NOTIFY
 PRTY
 REGION
 TIME
 TYPRUN
 MSGCLASS
 MSGLEVEL
 COND
 RESTART
CLASS PARAMETER

 Is an optional keyword parameter


 Specifies the type of JOB submitted to the system
 Some JOBS are CPU intensive, while others are more Input-Output
oriented; JOB characteristics like these are identified to the system
by the CLASS parameter
 Format is CLASS=<class> where <class> is a character between A
to Z or 0 to 9
 Installations will have a default class assigned to the CLASS
parameter
 Programmers to check with system administrator about list of
classes defined in the system
SPOOL
J1 & J2 Processed
J1 CLASS A CPU1
JES CLASS A & B
J3 Processed
CLASS B OS CPU 2
J2 CLASS Q

CPU 3
J3 CLASS Q
CLASS Parameter in JOB Statement
NOTIFY PARAMETER

 Specifies the user to whom JOB is to be submitted


after completion
 Can specify the user ID or the parameter (&SYSUID)
PRTY PARAMETER

PRTY
 Specifies priority for scheduling JOBS within a CLASS
 Permitted value ranges from 0 to 14 or 0 to 15
depending on JES2
PRTY PARAMETER
MSGCLASS PARAMETER

 Is an optional keyword parameter


 Specifies the specific output device to which the
messages are to be routed after completion of the
JOB
 Format is MSGCLASS=<classname> where
<classname> is a character between A to Z or 0 to 9
 Assigns JOB log to a particular sysout CLASS
 Installations will have a default class assigned to the
MSGCLASS parameter
 Programmers to check with system administrator
about list of message classes defined in the system
MSGLEVEL PARAMETER

Is an optional Keyword parameter


 Controls the level of listing of the JCL output of the JOB
 Formats available are
 MSGLEVEL=(<statements>, <messages>)
 MSGLEVEL=statements
 MSGLEVEL=(, <messages>)
Permitted values for statements are
 0 for listing only JOB statement
 1 for listing all JCL statements including procedures
 2 for listing only input statements
Permitted values for messages are
 0 for not listing any allocation messages
 1 for listing all allocation messages
 Preferred option is MSGLEVEL=(1,1)
MSGLEVEL=(0,0)
MSGLEVEL=(0,0)

 JESJCL: Shows only JOB


statement details

 JESYSMSG: Shows no
allocation message
details; Shows only
Start and Stop times
MSGLEVEL=(0,1)
 JESJCL: Shows only JOB
statement details

 JESYSMSG: Shows all


allocation messages
MSGLEVEL=(1,0)
 JESJCL: Shows all JCL
statements

 JESYSMSG: Shows no

allocation message

details; Shows only

Start and Stop times


MSGLEVEL=(1,1)

 JESJCL: Shows all


JCL statements

 JESYSMSG: Shows
all allocation
message
MSGLEVEL=(2,0)

 JESJCL: Shows all JCL


statements without
substitutions
 JESYSMSG: Shows no
allocation message
details; Shows only Start
and Stop times
MSGLEVEL=(2,1)
 JESJCL: Shows all JCL
statements without
substitutions
 JESYSMSG: Shows all
allocation message
COND Parameter

Overview
COND PARAMETER

 Specifies whether the JOB should continue or


terminate depending on the outcome of any step in
the JOB
 Before each step is executed, the system checks the
COND parameter against the return code from
completed JOB step
 If satisfied, the system terminates the JOB, else it
executes the JOB
 Format is COND=((code, operator), (code,
operator)…)
Interpretation of Condition
Codes
COND parameter check Return code from completed step
Terminate JOB Execute JOB

COND=(code,GT) RC < code RC > = code

COND=(code,GE) RC <= code RC > code

COND=(code,EQ) RC = code RC not = code

COND=(code,LT) RC > code RC < = code

COND=(code,LE) RC >= code RC < code

COND=(code,NE) RC not = code RC = code


COND PARAMETER
 In this visual, condition code set at
JOB level is COND=(4,LT)
which interprets that if the
Return Code from any step
is greater than 4, bypass the
remaining steps in the JOB
 Program
 RTCODE04 if executed
returns a RC of 4
 RTCODE08 if executed
returns a RC of 8
 RTCODE16 if executed
returns a RC of 16
 In the executed JOB STEP3 is
bypassed as the Return
Code from STEP2 is 8 which
is greater than 4
COND PARAMETER
 Visual shows part of the
JOBLOG of JOB executed
with COND=(4,LT)

 JOBLOB shows the JOB


terminated with STEP2
COND PARAMETER
 In the visual, condition code set
at JOB level is COND=(8,GE)
which interprets that if the RC
from any step is less than or
equal to 8, bypass the
remaining steps in the JOB
 Program
 RTCODE16 in STEP1 if
executed, returns a RC of
16
 RTCODE00 in STEP2 if
executed, returns a RC of
0
 RTCODE04 if executed
returns a RC of 4
 Result is STEP3 is bypassed as
the RC from STEP2 is 0 which is
less than 8
COND PARAMETER

 Visual shows part of the


JOBLOG of JOB executed
with COND=(8,GE)

 JOBLOG shows the JOB


terminated with STEP2
REGION PARAMETER

 Specifies the amount the workspace required by the operating


system to execute the JOB
 Value specified will apply to each step
Formats are:
 REGION=<value>K
 REGION=<value>M
 REGION parameter should only be in units of “K” or “M”
indicating Kilobytes or Megabytes of workspace requested;
Results in JCL error if unit is not specified
 If omitted, a default value is assigned by the system
 If REGION=0M is specified, the system takes the most
optimum space
Region
Region
Region
ADDRSPC PARAMETER
ADDRSPC Parameter
ADDRSPC SDSF Output
ADDRSPC SDSF Output
PAGES Parameter
TIME PARAMETER

 Specifies the maximum CPU execution time permitted for the


JOB
 If actual CPU execution time exceeds value specified in the
TIME parameter, JOB will fail with S322 abend
 Formats are
 TIME=(minutes, seconds)
 TIME=minutes
 TIME=(,seconds)
 TIME=1440
 TIME=NOLIMIT
 Seconds can be in the range from 0 to fifty nine
TIME Parameter
TYPRUN PARAMETER

 TYPRUN is used for special JOB processing


Formats are
 TYPRUN=HOLD
 TYPRUN=SCAN
 TYPRUN=HOLD causes the JOB to be held in the input
queue till released by an operator
 TYPRUN=SCAN causes the JCL to be scanned for
syntax errors and reports the errors. The JOB is not
executed when this option is used
RESTART PARAMETER

 Is an optional keyword parameter


 Instructs the JOB to restart execution from a specific
step, instead of from beginning of the JOB
 Formats are
 RESTART=<stepname>
 RESTART=<stepname.procstepname>
END

Você também pode gostar