2. Session Objectives
To understand the
Job Control Language
Introduction
Overview
JOB, EXEC and DD (Data Definition) Statements
Syntax of the various statements
Execution process
2
5. Job Control Language (JCL)
Describes to the
operating system the
work that has to be done
and the resources
required to do the work
MVS
5
6. Need for JCL
OS
Accounting Info Resources
Program
Region size
Job details
Priority
JCL
6
7. JCL Features
Consists of a set of statements called as Job Control Statements
Group of related JCL statements is known as Job
JCL consists of one or more Jobs
Job consists of Job steps to execute the instructions (tasks)
7
8. Job Control Task
Job Control Tasks,
Entering Jobs
Processing Jobs
Requesting Resources
are performed through,
JCL Statements
JES2 / JES3 Control Statements
8
9. Job Entry Subsystem
Receive jobs into the operating system and schedule them for processing
Manages the output processing of the job (spooling)
JES2 and JES3 are the two JES types provided by IBM
JES2/JES3 subsystems are part of the OS that manages Batch jobs and
Output
9
10. Job Submission Process
USER ACTIONS SYSTEM ACTIONS
Determine Create Submit JES interprets
the the the JCL & Passes
Job JCL Job it to MVS
System MVS does
Messages the work
JES Collects
User views &
the output &
interprets the
information about
output
the job
10
11. JCL Statement Syntax
Identifier
field
//NAME OPERATION OPERAND COMMENTS
Name Operation Operand / Comment
field field Parameter field
field
11
12. Identifier Field
Identifier field indicates to the system that a statement is a JCL
rather than data
Code the Identifier field beginning in column 1
Consists of
Column 1 and 2 of all the JCL statements (//)
Column 1 2 and 3 of a JCL statement ( //* for comment)
Column 1 and 2 to mark end of data (/*)
12
13. Name field
Identifies a particular statement so that the other statements and
the system can refer it
Syntax
name should start in column 3
name is 1 through 8 alphanumeric
name should be followed by a blank
first character should be a alphabetic or national ( $, #, @)
13
14. Operation Field
Specifies the type of the statement
Consists of characters in the syntax box for the statement
Follows the name field
Operation must be followed and preceded by at least one blank
Must begin on or before column 16
14
15. Parameter or Operand Field
Also called as Operand field
Must end before column 62
Contains parameters separated by commas
Positional and Keyword Parameters. An eg.
//RT452216 JOB 45992,CLASS=A
All positional parameters must precede all keyword parameters
Subparameters may be coded under Parameters to add further
meaning to the statement An eg.
//RT452216 JOB (45992,100,40),COND=(9,LT)
15
16. Comment Field
Used to enter a comment in the output listing
Used to document a job and its resource requirements
Can be placed anywhere after the job statement
Appears as //* in Column 1, 2 and 3
Comment field can be coded till Column 80
16
17. JCL Statements - Basics
Code the Operation, Operand and Comments fields in free form
with at least one blank in-between
Code the Name field immediately after the Identifier without any
blank column
All fields except for Operand must be separated by one blank
Only Columns 1 to 71 are used for JCL Content
Is case sensitive (Lower case not permitted)
17
18. JCL Statements – Basics (Contd.)
Statements can be continued in
the next line with // in 1 & 2
columns
The continued line must start
between columns 4 and 16
Marking the end of the JCL is
optional
18
20. JCL Statements - Essential
Each Job is identified by a JOB statement that marks the beginning
of a Job
Every job has one and only one job statement
Each Exec step is identified by an EXEC statement
EXEC (Execute) Statements follow the JOB Statement and has
the name of the Programs / PROC’s to execute
20
21. JCL Statements – Essential (Contd.)
Each Exec step may contain one or more control statements (DD
statements) to describe resources required for the Job step
DD Statements describe each data set & request the allocation
of I/O devices
Code the comment (//*) Statement to document the JCL
Code the delimiter (/*) Statement for marking the end-of-data for
in-stream data
21
22. JCL Statements - Optional
IF / THEN / ELSE / ENDIF Statement for selective execution of a Job
Step
SET Statement assigns symbolic parameter values
INCLUDE Statement to copy JCL from a file into Job Stream
PROC & PEND Statements mark the beginning and end of a
Procedure (Cataloged / in-stream)
JCLLIB Statement names the PROC & JCL Data set
22
23. IF/THEN/ELSE/ENDIF
Used to conditionally execute job step with job
Examples:
//NAME IF (RC GT 4) THEN
To Test if RETURN-CODE > 4
//NAME IF (STEP10.RC GT 4) THEN
To Test if RETURN-CODE from the
Job Step STEP10 > 4
23
25. SET Statement
Assign initial values to symbolic parameters
Change or Nullify the values of symbolic parameter
Syntax:
//[NAME] SET symbolic-parameter=values
If there are more than one parameter, separate them by comma
Example:
//SP1 SET PARM1=OLD,PARM2=22201
Parameter values containing special character enclosed by apostrophes
Example:
//SP3 SET PARM1=‘2004-10-13’
25
26. INCLUDE Statement
Identify the member of a partitioned dataset containing the JCL statement
Syntax:
//[NAME] INCLUDE MEMBER=name
INCLUDE group cannot contain
JOB Statement
PROC and PEND statement
JCLLIB statement
JES2 and JES3 statement
DD * and DD DATA statement
26
30. Session Coverage
Purpose of JOB Statement
Coding Syntax of JOB statements
Positional and Keyword parameters in a Job Statement
Examples
30
31. Purpose of JOB Statement
Identifies a job to the OS using a job
name
Indicates which user is responsible
for the job
Tells the system how to process the
job
31
32. JOB Statement - Syntax
•
Operation Field Comment Field
//Jobname JOB < parameters>..<comments>
Name Field Operand Field
(Job Name)
32
33. JOB Statement - Name field
//TRGR02Y JOB .......
Job name is TRGR02Y
Job name is @TEST
//@TEST JOB .......
33
34. JOB Statement - Operation field
//MYJOB JOB ...
JOB in Operation Field
specifies it as Job statement
//JOB1 JOB ...
34
35. Parameter Field
• //JOBNAME JOB <Parameters>
• The following list shows the parameters on Job statement
• ACCT-PARAMETER
• PROGRAMMER NAME
Positional Parameters
•
• CLASS COND
• PRTY NOTIFY
• MSGCLASS RESTART
Keyword
• MSGLEVEL ADDRSPC
• REGION TIME
Parameters
•
35
36. Positional Parameters
Job Statement can contain two positional parameters
First parameter should contain Accounting Information and the second parameter
should contain the Programmer’s name
These two parameters are optional, but installation may define them as
mandatory.
36
37. Positional Parameters - Accounting
Information
//JOB1 JOB (XYZ,TRG,3,DB2,123) ...........
Accounting information
//JOB2 JOB (XYZ,DHC,1,DTX99,TRGG01) ......
37
38. Accounting Information in Real world
Five Fields - all are mandatory
Field1 - Group or Project
Field2 - Sub-Group or module or Project
Field3 - User-id
Field4 - Location (here type D2 or D1)
Field5 - Type of Job (Give DT99X)
Example for Training:
(TRG,TRG,TRGG01,D2,DT99X)
38
39. Positional Parameters - Programmer’s
Name
•
//JOB1 JOB (XYZ,TRG,3,DB2,123),TRAINING.......
2nd positional parameter-
Accounting parameter programmer's name
//JOB2 JOB (XYZ,DH,1,DTX99,TRGR01),’XYZ TRG’.
//JOB3 JOB ,’Shane o’’Hara’.....
Programmer's name
parameter in quotes
No accounting Enclose programmer‘s name within
parameter apostrophe if it contains special character
39
40. Key Word Parameters
The Job Statement (or Job Card) can contain the following Keyword
parameters
CLASS PRTY
TIME ADDRSPC
REGION MSGCLASS
MSGLEVEL NOTIFY
COND RESTART
TYPRUN
40
41. Keyword Parameters - CLASS
Syntax:
CLASS=<job class>
Examples:
//JOB1 JOB ACCT1,CLASS=A..
//JOB2 JOB ACCT1,CLASS=B.... JOB1 IS ASSIGNED TO CLASS A
//JOB3 JOB ACCT1,CLASS=C.... JOB2 IS ASSIGNED TO CLASS B
//JOB4 JOB ACCT1,CLASS=D....
JOB3 IS ASSIGNED TO CLASS C
JOB4 IS ASSIGNED TO CLASS D
41
42. Class Definitions in Real world
Installation
Class A -- 2 sec
Class B -- 7 sec
Class C -- 19 sec
Class D -- 46 sec
Class E -- 5 mins
Class H -- Held Class
Class T -- 5 mins (for tapes only)
Class R -- 5 mins. (cartridges only)
Time specified are CPU time
42
43. Keyword Parameters - TIME
Syntax:
Allows this job to use 2 min
TIME=([minutes][,seconds]) 30 sec of CPU time
Examples:
//JOB1 JOB ACCT1,CLASS=E,TIME=(2,30)....
Allows this job to use
30 sec of CPU time
//JOB2 JOB ACCT1,CLASS=E,TIME=(,30)...
//JOB3 JOB ACCT1,CLASS=E,TIME=2.... Allows this job to use
2 mins of CPU time
43
44. Keyword Parameters – TIME (Contd.)
Syntax:
TIME=([1440]| [NOLIMIT] | [MAXIMUM])
Examples:
//JOB4 JOB ACCT1,CLASS=E,TIME=1440....
//JOB5 JOB ACCT1,CLASS=E,TIME=NOLIMIT.... These jobs can use the processor
for unlimited amount of time
//JOB6 JOB ACCT1,CLASS=E,TIME=MAXIMUM....
This job can run for maximum amount
of time that is 357912 minutes.
44
45. Keyword Parameters - PRTY
To assign the selection priority to the JOB
Syntax:
PRTY=(number)
Examples:
//JOB4 JOB ACCT1,CLASS=E,PRTY=12...
45
46. Keyword Parameters - REGION
Syntax:
REGION={valueK | valueM}
Examples:
//JOB1 JOB ACT1,CLASS=A,ADDRSPC=REAL,REGION=200K.
Specifies 200 kilo bytes of
//JOB2 JOB ACT1,’TRG’,CLASS=A,REGION=20M. central storage is required for
this job(JOB1)
Specifies 20 mega bytes of
virtual storage is required for
this job(JOB2)
46
47. Keyword Parameters - ADDRSPC
Syntax:
ADDRSPC={REAL | VIRT}
Examples:
//JOB1 JOB ACT1,CLASS=A,ADDRSPC=REAL,REGION=20K
Non pageable central storage of 20k
is required for this job(JOB1)
//JOB1 JOB ACT1,CLASS=A,ADDRSPC=VIRT,REGION=20K
Pageable virtual storage of 20k
is required for this job(JOB1)
47
49. Keyword Parameters - MSGLEVEL
Details in the listing of Joblog can be controlled, using MSGLEVEL
parameter
Syntax:
MSGLEVEL=([statements][,messages])
Job log contains the following information :
JCL Statements
Procedure Statements for any procedure job step calls
Messages about Job control statements, allocation of devices and
volumes, execution and termination of job steps and disposition of
datasets
49
50. Keyword Parameters - MSGLEVEL
• Statements - Controls the listing of JCL statements in Job log
• 0 - The system prints the JOB statement, comments
• and all statements up to the first EXEC
• statement
• 1 – The system prints all the JCL statements, control
• statements, Procedure statements and values
• assigned to symbolic parameter’s
• 2 – The system prints all the JCL statements and control
statements
50
51. Keyword Parameters - MSGLEVEL
• Messages - To control the listing of JCL and JES
• messages in Job log
• 0 – The system prints only the JCL messages
• 1 – The system prints, JCL, operator and SMS
• messages
51
52. Statements sub-parameter -
MSGLEVEL
MSGLEVEL=([statements][,messages])
Only job statement
is printed for job(job1)
//JOB1 JOB AC1,MSGCLASS=X,MSGLEVEL=(0,1)..
NO parentheses ??
//JOB2 JOB AC1,MSGCLASS=X,MSGLEVEL=2..
Both Statements and
Messages are printed
//JOB3 JOB AC1,MSGCLASS=X,MSGLEVEL=(1,1)
52
53. Messages sub-parameter - MSGLEVEL
MSGLEVEL=([statements][,messages]) Only JCL messages are
printed for job(job1)
//JOB1 JOB AC1,MSGCLASS=X,MSGLEVEL=(0,0)..
No value for messages
Sub-parameter. Takes
//JOB2 JOB ACC1,MSGCLASS=X,MSGLEVEL=2.. default.
All messages are printed
//JOB3 JOB AC1,MSGCLASS=X,MSGLEVEL=(,1)
53
54. Keyword Parameters - NOTIFY
Syntax:
NOTIFY=<user-id> or
NOTIFY=<nodeid.userid> or
NOTIFY=<&SYSUID> User-id TRGG01 is notified
Examples: after completion of this job
//JOB1 JOB ACCT1,CLASS=A,NOTIFY=TRGG01..
//JOB2 JOB ACCT1,NOTIFY=XYZMN03.TRGG02..
User-id TRGG02 at XYZMN03 is
Notified after completion of this job
54
55. Keyword Parameters - TYPRUN
Syntax:
TYPRUN={HOLD|SCAN}
Checks job’s JCL for syntax errors.
Examples: Job is not submitted for execution
//JOB1 JOB ACCT1,MSGCLASS=X,TYPRUN=SCAN..
//JOB2 JOB ACCT1,MSGCLASS=X,TYPRUN=HOLD..
This job waits for execution until
operator releases it for execution
55
56. Keyword Parameter - RESTART
Syntax:
RESTART={* } Restart job at first job step itself
{stepname}
{stepname.procstepname}
Stepname:
indicates the job step from which to restart the job
Stepname.procstepname:
stepname refers to the EXEC statement of the jobstep that calls the
procedure.
Procstepname refers to the EXEC statement of the procedure step.
If the stepname refers to the EXEC statement in a procedure then
procedure name is also specified.
56
57. Keyword parameter - RESTART
Example:
//JOB1 JOB ACCT1,MSGCLASS=X,RESTART=COUNT..
Restart from step
COUNT
//JOB1 JOB CCT1,MSGCLASS=X,RESTART=PROC1.COUNT..
Restart from step
COUNT in procedure
step PROC1
57
59. Summary
The purpose of the JOB statement
Coding Syntax of JOB statement
Various options for the Positional and keyword parameters
Examples of JOB statement
59
61. Session Coverage
Purpose of Exec Statement
Coding Syntax of Exec statements
Positional and Keyword parameters in an Exec Statement
Examples
61
62. Purpose of Exec Statement
Used to specify which program or procedure an individual job step
has to execute
Tells system how to process the job step
62
63. Exec Statement: Example
OS
Processing parameters
Beginning of step
Parameters to program
JCL Program or Proc name
//JOB1 JOB AC1,
// CLASS=A
//ST1 EXEC PGM=P1,
// PARM=‘04/11/01’.
// REGION=800K
// ..... DD ..
//
63
64. EXEC Statement in JCL
• //JOB1 JOB .... • Beginning of JOB
• //ST1 EXEC PGM=P1 • Beginning of step ST1
• //INPUT DD ..... • Statements that follow the Exec step ST1
• ............. •
• ............. •
• //ST2 EXEC PGM=P2 • Beginning of step ST2
• //INPUT DD ..... • Statements that follow the Exec step ST2
• .......... •
• // • End of Job
64
65. EXEC STATEMENT - Syntax
•
Operation Field Comment Field
//Stepname EXEC < parameters>.. <comments>
Name Field Parameters Field
65
67. Parameter Field
• //STEPNAME EXEC <Parameters>
• The following list shows the important parameters on Exec statement
• PROGRAM NAME
• (PGM= or PROC=)
Positional Parameter
• ACCT PARM
• ADDRSPC REGION
• TIME COND Keyword
Parameters
67
68. Positional Parameters
Syntax:
PGM=<program name> OR
PROC=<procedure name> OR
<procedure name>
Examples:
//STEP1 EXEC PGM=TEST
STEP1 executes program TEST
//STEP2 EXEC PROC=COMPILE
//STEP3 EXEC COMPILE
STEP2 & STEP3 invokes JCL
procedure COMPILE
68
69. Key Word Parameters
The EXEC statement can contain the following Keyword
parameters :
ACCT •
PARM
ADDRSPC
REGION
TIME
COND
69
70. Key word Parameters
ACCT – provides accounting information for the job step
ADDRSPC – prevents the step from being paged
REGION - specifies the region size to allocate to a job step
TIME - imposes a CPU time limit on the job step
70
71. Keyword Parameter - PARM
Syntax:
PARM=(<sub parameter,[sub parameter]>)
Examples: 25/01/01 is enclosed in
apostrophes because it contains
//STEP1 EXEC PGM=P1,PARM=TRGXYZ special characters ‘/’
//STEP2 EXEC PGM=P2,PARM=(10,’25/01/01’)
//STEP3 EXEC PGM=P3,PARM=‘25&&45’
Passes string 25&45
to program P3
71
72. Program Execution using PARM
JCL for executing program CP1 Cobol Program-CP1
• //JOB1 JOB ACCT1,TRG-GRP,
• // CLASS=B,NOTIFY=TRG???, • IDENTIFICATION DIVISION.
• // MSGCLASS=X • ENVIRONMENT DIVISION.
• //*This is to demonstrate • DATA DIVISION.
passing • WORKING STORAGE SECTION.
• //* parameters to program • LINKAGE SECTION.
thru JCL
• //STEP1 EXEC PGM=CP1, • 01 WS-DATE
• // PARM=‘31/03/01’ • 05 WS-CTRL-LEN PIC S9(4)
• // ...... ...... ..... COMP SYNC.
• // • 05 WS-CTRL-DATE X(8).
• //*This JCL executes • PROCEDURE DIVISION USING
program CP1 • WS-DATE.
72
73. Keyword Parameter - COND
Syntax:
COND=(code,Operator[,step name]) [,EVEN | ONLY]
Examples:
//STP1 EXEC PGM=P1,COND=(0,NE)
If any preceding step
returns non zero return
code this step is bypassed
//STP2 EXEC PGM=P2,COND=(4,LT,STP1)
If step STP1 returns a code less
than or equal to 4 then this step is
executed else bypassed.
73
74. Keyword Parameter- COND
Examples:
//STP1 EXEC PGM=P1,COND=EVEN
STP1 is executed even if a
preceding step abends
//STP2 EXEC PGM=P3,COND=((4,LE,STP1),ONLY)
STP2 is executed only if a preceding
step abends and return code of STP1
is less than 4
74
75. Relational Operators for COND
Rt r c d ( C f o jutc ml t dse
eun o eR ) r m s o pee t p
c n pr mt r
o d aa ee c ni u j bi
o tn e o f t r i aej bi
em t o f
n
C N =c d,G) R > c d
O D( o e T C =o e R <o e
Cc d
C N =c d,G) R >o e
O D( o e E Cc d R <c d
C=o e
C N =c d,E ) R ! c d
O D( o e Q C =o e R =o e
Cc d
C N =c d,L ) R < c d
O D( o e T C=o e R >o e
Cc d
C N =c d,L ) R <o e
O D( o e E Cc d R >c d
C=o e
C N =c d,N) R =o e
O D( o e E Cc d R! cd
C=o e
75
76. COND Parameter with Return Codes
• Job requiring special
Conditional execution
• ABOUT SELECT PROGRAM.
STP1 If Step • SELECT PROGRAM :
SELECT ABENDS • RETURNS - 0, IF AT LEAST ONE
RECORD IS SELECTED FOR
PROCESSING BY UPDATE
STP3 PROGRAM.
RC ABDMP END
• RETURNS - 12, IF NO RECORDS
12 ARE SELECTED FOR
0 PROCESSING BY UPDATE
If Records Exist
PROGRAM.
to Process
STP2 If Step
END
UPDATE ABENDS
76
77. COND Parameter with Return Codes
(Contd.)
JCL for executing JOB described in the previous slide
//JOB1 JOB ACT1,TRG,CLASS=B,NOTIFY=TRGXXX
//STP1 EXEC PGM=SELECT
..... ...... DD STATEMENTS......
//STP2 EXEC PGM=UPDATE,COND=(12,LE,STP1)
..... ...... DD STATEMENTS......
//STP3 EXEC PGM=ABDMP,COND=ONLY
..... ...... DD STATEMENTS......
//
77
78. EXEC Statement Examples
• //TRGR02XX JOB (TRG,GEN,TRGR02,AA,DT99X),
• // ‘TRG’,CLASS=B,NOTIFY=TRGR02,MSGCLASS=X
• //ALLOC EXEC PGM=IEFBR14 This step allocates data sets
• .... ........ .......... .......... ....
• //COB EXEC PGM=IGYCRCTL,COND=(4,LT), This step compiles a program
• // PARM=‘NUM,SOURCE,LIB,RES’,
• // REGION=2048K
• .... ........ .......... .......... ....
• //STPZ EXEC PGM=IEWL,PARM=‘REUS,LET’, This step does link editing
• // COND=((4,LT,COB),(4,LT,ALLOC))
• .... ........ .......... .......... ....
• //
78
79. DD statement in EXEC cont....
• DD statement in EXEC statement is optional. DD statement is used
for specifying any input to the program or to specify where the output is to be
printed. If there is no input file and if there is no need of output, then we can
ignore the DD statement in EXEC part.
• System generation programs and the programs that are in system
library syslib and proclib can be executed by using EXEC statement without a
DD statement.
•Eg: //TRGRXX JOB 'MVS-MVS-U237011-Z9-DT08X',REGION=2096K
• //IKJACCNT EXEC IKJACCNT
• Once you login the mainframes region, the above job will start
executing automatically, this needs no DD statement.
79
80. Summary
The purpose of the Exec statement
Coding Syntax of Exec statement
Various options for the Positional and keyword parameters
Examples of Exec statement
80
82. Session Coverage
Purpose of DD Statement
Coding Syntax of DD statements
Temporary data sets
DASD data sets
Instream and SYSOUT data sets
Examples
82
83. Purpose of DD Statement
•
OS
I/P & O/P data sets
Program location
Data set integrity Constraints
Input data
Resources required by job & processing program
DD Statements
83
85. DD Statement - Syntax
•
Operation Field Comment Field
//ddname DD < parameters>.. <comments>
Name Field Key word Parameters Field
(DD Name)
85
86. Keyword Parameters for DASD
datasets
• //ddname DD DSNAME=dataset name
• ,DISP=file’s status
• [ ,UNIT=device where the file exists ]
• [ ,VOL=SER=serial number of the volume ]
• [ ,SPACE=DASD space to be allocated ]
• [ ,DCB=Options for file’s data control block ]
86
87. DSNAME Parameter
DSN Parameter specifies the Physical file name to be associated
with the DD Name referred by processing program or system.
DD Name Data set name in DSN
LOGICAL FILES NAME or PHYSICAL DATA SET
DD NAME - Referred by For the DD name referred
processing program or system by program or system
87
88. DSNAME Parameter
Syntax:
DSN=<data set name> | <DSNAME(member)>| NULLFILE
Dataset name can be :
Qualified data set name
Unqualified data set name
NULLFILE
PDS member name
Temporary data set name
88
89. DSNAME Parameter : Examples
Qualified data set name
//INFILE DD DSN=TRGXX.SRC.COBOL, .....
Unqualified name as data set name
//DD1 DD DSNAME=TRGXX, ......
Data set name for a Dummy Data set
//OUTFILE DD DSN=NULLFILE
Member of a PDS as data set name(qualified data set name)
//INFILE DD DSN=TRGXX.SRC(MEM1) .....
89
90. Temporary Dataset
Syntax:
DSN=&&<data set name>
Dataset exists only during the execution of job. Usually called as Work files.
Always deleted at the end of job
Resides in Virtual Storage
Compound DSN, joined by period not allowed in temporary dataset
90
92. DD Statements in relation with
programs
Cobol Program-CP1 JCL for executing program CP1
• IDENTIFICATION DIVISION. • //JOB1 JOB ACCT1,TRG-GRP,
• ENVIRONMENT DIVISION. • // CLASS=B,NOTIFY=TRG???,
• SELECT INPUT ASSIGN TO • //STEP1 EXEC PGM=CP1
• INDD. • //INDD DD ......
• SELECT OUTPUT ASSIGN TO • //OUTDD DD .......
• OUTDD. • //
• DATA DIVISION. • //*This is to demonstrate
• WORKING STORAGESECTION. relation between program
ddnames names to ddnames in
• PROCEDURE DIVISION.......
JCL.
...... .......
• //*This Run JCL for program
CP1
92
93. DISPOSITION Parameter - DISP
Syntax:
DISP=<([current status][,normal termination DISP]
[,abnormal termination DISP])>
CURRENT NORMAL ABNORMAL
STATUS TERMINATION TERMINATION
NEW DELETE DELETE
OLD KEEP KEEP
SHR PASS CATLG
MOD CATLG UNCATLG
UNCATLG
93
94. DISP-Current Status : Examples
Sharing the already existing data set.
//INFILE DD DSN=TRGXX.SRC(MEM1),DISP=SHR
Exclusive control over already existing data set or writing to existing
data set. Existing records will be deleted.
//OUTFILE DD DSN=TRGXX.OUT,DISP=OLD
Creating new data set.
//NEWDD DD DSN=TRGXX.NEW,DISP=NEW........
For updating the existing data set in exclusive access mode and is
positioned at the end of the data, so the records may be added to
the end.
//DD1 DD DSN=TRGXX.TRN,DISP=MOD .....
94
95. DISP-Normal Termination : Examples
Request to keep the data set on normal completion of step.
//INFILE DD DSN=TRGXX.SRC,DISP=(SHR.KEEP)
To delete the data set on normal completion of step.
//OUTFILE DD DSN=TRGX.OUT,DISP=(OLD,DELETE)
To catalog the data set on normal termination of step.
//NEWDD DD DSN=TRGX.NEW,DISP=(NEW,CATLG)
To pass data set for use by subsequent step on normal termination
of step.
//DD1 DD DSN=TRGXX.TRN,DISP=(MOD,PASS)
95
96. DISP-Abnormal Termination : Examples
To Keep the data set on abnormal completion of step.
//FILE1 DD DSN=TRGX.SRC,DISP=(SHR,PASS,KEEP)
To Uncatalog the data set on abnormal completion of step.
//OUT1 DD DSN=TRGX.OUT,DISP=(OLD,,UNCATLG)
To Catalog the data set on abnormal termination of step.
//NEWDD DD DSN=TRGX.NEW,DISP=(NEW,,CATLG)
To Delete data set on abnormal termination of step.
//DD1 DD DSN=TRGXX.TRN,DISP=(,PASS,DELETE)
96
97. DISP Parameter - Defaults
• DISP coded on DD statement System Interpretation
• by default
• NO DISP PARAMETER DISP=(NEW,DELETE,DELETE)
• DISP=SHR DISP=(SHR,KEEP,KEEP)
• DISP=OLD DISP=(OLD,KEEP,KEEP)
• DISP=(,CATLG) DISP=(NEW,CATLG,CATLG)
• DISP=(OLD,,DELETE) DISP=(OLD,KEEP,DELETE)
• DISP=MOD (Treated as new) DISP=(MOD,DELETE,DELETE)
• DISP=MOD (Treated as old ) DISP=(MOD,KEEP,KEEP)
97
98. Parameters to Define Location of
Datasets
UNIT
Specifies the physical device where an existing dataset can be found or
where a new one can be found
Specify only installation defined group of devices
VOLUME
Specifies the volume serial number of the particular tape or disk
involved
Volume parameter is optional for new datasets
For Cataloged datasets, Unit and Volume details need not be specified
98
99. UNIT Parameter
Syntax:
UNIT=({[device-number][device-type] [group-name]}
{[,unit-count] [,P]} [,DEFER] )
or UNIT=AFF=ddname
Examples:
//DD1 DD DSN=TRG1.U1,DISP=(NEW,KEEP),
// UNIT=3380 device-type
//DD2 DD DSN=TRG1.U,UNIT=SYSDA group name
99
100. UNIT Parameter
• //DD1 DD DSN=TRG1.U1,DISP=MOD,
• // UNIT=(3390,2) 2 devices are requested
• //DD2 DD DSN=TRG1.U,DISP=SHR,
• // UNIT=(,,DEFER) request to defer mounting
• //DD3 DD DSN=TRG1.AFF,DISP=OLD,
• // UNIT=AFF=DD1 requests same two devices as
• Step DD1
100
104. SPACE Parameter
Syntax:
SPACE=
({TRK,}(prqty[,secqty][,dir])[,RLSE][,CONTIG][,ROUND])
{CYL,}
{blklen,}
Number of Units Special Processing Requests
Measurement
Unit
104
105. DCB Parameter
DCB to define the Characteristics of individual data sets.
Syntax:
DCB=(LRECL=nn[,BLKSIZE=yy][,RECFM=zz]
[,DSORG=mm])
nn - Logical Record Length
yy - Block size
zz - Record Format (F,FB,V,VB or U)
mm - Data Set Organization (PS or PO)
107
106. DCB Parameter : Examples
DCB for new PS data set with fixed record length of 80 with
blocking(block contains 10 records)
//DD1 DD DSN=TRG.DCB,DISP=(NEW,CATLG),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
// SPACE=(TRK,(5,5))
DCB for new PDS data set with variable record length of 80 and no
blocking..
//DD1 DD DSN=TRG.DCB,DISP=(NEW,CATLG),
// DCB=(LRECL=80,RECFM=V,DSORG=PO),
// SPACE=(TRK,(5,5,2))
108
107. DD Statement for Instream data sets
Syntax:
//ddname DD (*) [ ,DLM=xx ]
(DATA)
Programs will treat the instream data as if it comes from a
sequential file of 80-Character records
JES will copy the instream data to a spool volume
Processing program can retrieve data from spool volume as it
executes
109
108. Instream data sets : Examples
Example 1:
//INDATA DD *
Bh009189lk56
Akp0789mjirm
/*
Example 2:
//INDATA DD DATA,DLM=@@
//STEP1 EXEC PGM=INPROG
//INPFIL DD SYSOUT=A
/*
110
109. DD Statement for SYSOUT data sets
Syntax:
//ddname DD SYSOUT=x
Example:
//SYSPRINT DD SYSOUT=A
The SYSOUT parameter
indicates that the data set should be processed by JES2/JES3
Specifies the output class associated with the data set
111
110. DD Statements for Execution related
Data sets
Specifying private program library
JOBLIB
STEPLIB
Specifying dump data set
112
111. Specifying Private Program libraries
Private libraries are specified to execute programs that do not
reside in the system libraries
Job library applies to entire job
Step libraries applies to only one step in a job
If both JOBLIB and STEPLIB DD statements are coded, step library is
searched first
(Job library ignored for that job step)
113
114. Specifying Dump data set
Storage dump is the content of the virtual storage used by the
program before the job terminates with error
To obtain storage dump, code DD statement named
SYSUDUMP, SYSABEND, or SYSMDUMP
Syntax:
//SYSDUMP DD SYSOUT=*
If a job step ends normally, the dump DD statement is ignored
116
115. Summary
The purpose of the DD statement
Coding Syntax of DD statements for
Temporary data sets
DASD data sets
Instream data sets
SYSOUT data sets
Dataset Attributes
DD Statements to specify private library data sets and dump data
sets
117
116. In-Stream and Cataloged Procedures
•
• As you gain more experience in submitting jobs, you will
find that you often use the same set of job control statements
repeatedly with little or no change.
•
• To save time and prevent errors, you can prepare sets of
job control statements that you can execute again and again. You
can do this through the use of two types of procedures: in-stream
procedures and cataloged procedures.
118
117. In-Stream procedure
• An in-stream procedure is a named set of job control
statements in a job that can be re-executed within that job, simply
by invoking the name of the procedure.
• This enables you to execute the set of control
statements more than one time in the same job without having to
repeat the statements.
• The maximum number of in-stream procedures you can code in any
job is 15.
119
118. Example ..
• Job Control Statement Explanation
• //JOB1 JOB CT1492,'JIM MOSER' Starts job
• //PTEST PROC Starts in-stream procedure
• //PSTA EXEC PGM=CALC Identifies first step in procedure
• //DDA DD DSNAME=D.E.F,DISP=OLD Request 3 data sets for first procedure step
• //DDB DD DSNAME=DATA1,DISP=(MOD,PASS)
• //DDOUT DD SYSOUT=*
• //PSTB EXEC PGM=PRNT Identifies second step in procedure
• //DDC DD DSNAME=*.PSTA.DDB,DISP=OLD Request 2 data sets for second procedure step
• //DDREP DD SYSOUT=A
• // PEND Ends in-stream procedure
• //STEP1 EXEC PROC=PTEST First step in JOB1, executes procedure
• //PSTA.IN DD * Adds in-stream data to procedure step
• . PSTA
• (data)
• .
• /*
•
120
119. Cataloged Procedure
• A cataloged procedure, like an in-stream procedure, is a
named set of job control statements. However, these control
statements are placed, or cataloged, in a partitioned data set (PDS)
known as a procedure library. This enables a cataloged procedure
to be invoked by any job.
• Cataloged procedures can be placed in the system
procedure library SYS1.PROCLIB or in any user-specified procedure
library (for example JCLLIB).
121
120. Example...
• Job Control Statement Explanation
• //MYPROC PROC Starts cataloged procedure
• //MY1 EXEC PGM=WORK1 Identifies first step in procedure
• //MYDDA DD SYSOUT=A Request 2 data sets for first procedure step
//MYDDB DD SYSOUT=*
//MY2 EXEC PGM=TEXT5 Identifies second step in procedure
• //MYDDC DD DSNAME=F.G.H,DISP=OLD Request 2 data sets for second procedure
step
//MYDDE DD SYSOUT=*
// PEND Indicate end of procedure
• Job Control Statement Explanation
• //JOB2 JOB ,'JACKIE DIGIAN' Starts job
• //STEPA EXEC PROC=MYPROC First step in JOB2, executes procedure
• //MY2.MYDDC DD DISP=(OLD,DELETE) Modifies DD statement MYDDC in procedure
step MY2
122
123. JES (Job Entry Subsystem)
Internal Readers JES2/JES3
handles the Input Processing
JES will select from the
initiator, the highest priority
job classes to run
Initiator allocates the
resources required for the
job
125
124. Conversion Processing
Conversion processing
assigns a job number to the job
analyzes the JCL statements
merges in any cataloged procedures which they reference
converts the JCL into "internal text", which is meaningful to JES
and the MVS job scheduler
checks for syntax errors
invokes various user exits
if no errors are found, the converter stores the internal text on
the "spool" dataset and adds the job to the input queue
126
125. Execution Processing
JES2 keeps track of each job by
building a Job Queue Element
On the Queue, job is selected by
Is initiator available for this
job class
If more than 1 class for the
initiator, then select in order
of class
Is the priority of the job
highest in the queue for this
job class
At the completion of the job, JES
places the job in output queue
127
126. Spooling
Simultaneous Peripheral Operations On Line
Spool is a buffer that holds
O/P for printers and process
instructions as devices
become available
As one task is waiting for
resource, the next one is
taken for execution
All output to spooled devices
is first written to disk
Spooled O/P is then stored
and scheduled until the
printer is available
128
127. Output/Print/Purge Processing
JES2 processes SYSOUT data sets either when job ends or data set is
closed
O/P datasets are written to Print files in JES2 SPOOL
The Print Processors selects the job by priority within class and
print output
Once job processing is completed, the access space released and
job number becomes available for a new job
129
130. Fundamentals
Modular programming:
Aims to split a problem into small, manageable units of work
(modules).
Source module:
Program written in a symbolic language.
Forms the input to a language translator.
Object module:
The output from a language translator.
Forms the input to the linkage editor.
An object module may, however, be directly executed via the Loader.
Load module:
The output from the linkage editor; it is in a readily executable
format.
132
133. DD Names for compile-link-go
•
procedures
COBOL Compile Step DD names
• SYSIN - Source program input for the COBOL compiler.
• SYSLIB - The copy library or libraries.
• SYSLIN - Object module output.
• SYSPRINT- Print Data set
• Link-edit Step DD names
• SYSLIB - The subprogram library or libraries.
• SYSLIN - Object module input.
• SYSIN - Additional object module input.
• SYSLMOD - Load module output.
• Execute (run) step DD names
• SYSOUT - Output from DISPLAY statements.
• SYSDBOUT - Symbolic debugging output.
• SYSABEND/SYSUDUMP- Abnormal termination (or storage dump)
output.
135
134. Linkage-editor Parm Options
LIST - lists the linkage-editor control statements
MAP - produces a storage map showing the length and relative
locations of all control sections.
XREF - includes MAP plus a cross-reference table of the load
module.
AMODE - value specifies whether the program uses 24- or 31- or
64- bit addressing
RMODE - value indicates where in Virtual Storage, the program
must be loaded (24 or ANY)
136
138. Summary
The Compilation-Linkedit and execution procedure
DD Statements involved in Compile-Linkedit-Run steps
Sample Compilation and Linkedit jobs
Sample Run JCL
140