Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
: Introduction to JCL
Evaluation Criteria
25
Introduction to JCL
Module No.
Topic
1.
2. 3. 4. 5. 6. 7.
Introduction to JCL
JCL Statements JOB Statements EXEC Statements DD Statements Procedures Utility Programs
25
Introduction to JCL
Introduction to JCL
25
Introduction to JCL
In the early period of computer usage the systems were largely batch-
oriented and the input to the system was through punched cards . These cards had 80 columns in which statements could be punched and had to be read through a complex procedure. Although these are no longer in use and terminals are used for inputting, the basic 80 column format remains unchanged . The most common cards are JOB, EXEC and DD. The set of cards that are required to execute a job is called a batch and hence the term Batch Processing.
25
Introduction to JCL
// DD // EXEC // JOB
25
Introduction to JCL
It is a language using which the user interfaces with the operating system
and describes the program steps to be run. Defines the files (datasets) from which inputs have to be taken and results written on to. Indicates accounting information (Who is the user, How much resources he is using etc.,) Defines the resource limits the user has to operate within (No. of CPU secs, size of memory allocation etc.) Directs the print output to the defined printer.
25
Introduction to JCL
USER 2
JCL
JCL USER 1
OPERATING SYSTEM
JCL USER 3
25
Introduction to JCL
25
Introduction to JCL
// TEXT #2 JOB(2237,4), PHASE 1,CLASS=A //STEP1 EXEC Execute CALC PGM=CALC Program Execute SORT Program
//STEP2
EXEC
PGM=SORT
//STEP1
EXEC
Introduction to JCL
10
Introduction to JCL
11
25
Introduction to JCL
12
Introduction to JCL
13
IDENTIFIER FIELD
NAME FIELD
OPERATION FIELD
PARAMETER FIELD
COMMENT FIELD
25
Introduction to JCL
14
The Identifier field indicates the type of statement to the system. // in the first 2 columns indicates that the statement is a JCL statement. / * in the first 2 columns indicates that it is a delimiter of the preceding statements. / / * in the first 3 columns indicates that it is a comment statement which has to be ignored by the system.
25
Introduction to JCL
15
//
* //*
Column 1
25
Introduction to JCL
16
25
Introduction to JCL
17
//CGI001A
//#1STEP
//AB004
25
Introduction to JCL
18
Operation field should be preceded and followed by at least one blank space.
25
Introduction to JCL
19
25
Introduction to JCL
20
Introduction to JCL
21
(1024,14),JONES,CLASS=A
PGM=IEFBR14
DSN=&&TEMP,DISP=OLD
25
Introduction to JCL
22
Introduction to JCL
23
//SYSIN
DD
DATA
25
Introduction to JCL
24
25
Introduction to JCL
25
//INFILE DD //OUT1 DD
DSN=CPVJPO.JCL.J1,DISP=OLD DSN=&&TEMP,DISP=OLD
25
Introduction to JCL
26
Comment filed can be coded if there is at least 1 operand field. It should follow the Parameter list. It should be preceded by at least one blank space. It can be extended up to Column 80.
25
Introduction to JCL
27
Operand PGM=ADDPGM
//IN1
DD
25
Introduction to JCL
28
Any JCL statement can be extended up to Column 71. If we wish to continue this statement, we normally interrupt this statement after a complete parameter field.
The next line will have // in the first 2 columns and then the previous statement can be continued anywhere between Columns 4 and 16.
It is a good practice to start the continuation line at column 12.
25
Introduction to JCL
29
Col 1 //OUT1 // //
25
Introduction to JCL
30
Introduction to JCL
31
Col1 //TESTSP EXEC SORT5 This step will // execute a sort procedure
Col 72 *
25
Introduction to JCL
32
25
Introduction to JCL
33
//* This JCL will execute 2 steps //* This step will sort an input file and //* store the result in another file.
25
Introduction to JCL
34
Columns 12 3 4 12 / / JOBNAME JOB / / / / JOB1 First JOB JOB 71 72 73 80 <Parameter Fields> Comment field A2312,JOHNNY * This is my
25
Introduction to JCL
35
Job Statement
25
Introduction to JCL
36
Each Job must begin with a single JOB statement. Installations usually establish a fixed JOB statement format that must be used.
25
Introduction to JCL
37
25
Introduction to JCL
38
It can range from one to eight alphanumeric (A-Z, 0-9) or national characters (@,#,$).
or national characters.
25
Introduction to JCL
39
25
Introduction to JCL
40
25
Introduction to JCL
41
ACCOUNTING INFORMATION This must be defined by an installation. All sub-parameters must be separated by commas. If it contains any special characters, it should be enclosed within apostrophes.
25
Introduction to JCL
42
(acct-number,additional-acct-information)
//JOBNAME //JOBNAME
25
Introduction to JCL
43
One to twenty character name. If it contains special characters, it must be enclosed within apostrophes. A legitimate apostrophe is coded as two consecutive apostrophes.
25
Introduction to JCL
44
25
Introduction to JCL
45
Most of the keyword parameters have installation standard values which should be used when coded. If standards are not followed, it is automatically replaced by the system.
25
Introduction to JCL
46
25
Introduction to JCL
47
Introduction to JCL
48
25
Introduction to JCL
49
25
Introduction to JCL
50
25
Introduction to JCL
51
Introduction to JCL
52
//JOBNAME JOB CLASS=A,MSGCLASS=D,MSGLEVEL=(0,0) //JOBNAME JOB MSGCLASS=H,MSGLEVEL=2 //JOBNAME JOB MSGLEVEL=( ,1)
25
Introduction to JCL
53
TYPRUN=SCAN, checks the JCL for syntax errors and suppresses execution of the job. TYPRUN=HOLD, holds a job in the input queue for later execution. The job is held until the operator releases it. TYPRUN=JCLHOLD, also holds the job till the operator releases it, but differs from TYPRUN=HOLD, in that the JCL is not checked until the operator releases the job.
25
Introduction to JCL
54
25
Introduction to JCL
55
MVS allows programs that abnormally terminate, or even those that run to completion, to be restarted so that the entire job does not need to be returned in the event of an error.
To do this, code a RESTART parameter on the JOB statement to name the step from which to restart and submit the job.
25
Introduction to JCL
56
RESTART = stepname //RT45367 JOB(45992),SMITH,CLASS=A,RESTART=STEP6 //RT452216 JOB CLASS=A,RESTART=RUN.LKED //RT452216 JOB CLASS=B,RESTART=*
25
Introduction to JCL
57
Specifies the priority with which jobs are selected from the queue to be executed. It may range from 0 - 15. If omitted, installation default is assigned. Priority is within job class.
25
Introduction to JCL
58
25
Introduction to JCL
59
It requests the system to send a message to your time-sharing terminal when the batch job completes.
If not online, when the job completes, the message will be saved and displayed when you next log on.
25
Introduction to JCL
60
NOTIFY=user-id
25
Introduction to JCL
61
Introduction to JCL
62
25
Introduction to JCL
63
When a condition is to be checked on all the job steps, COND is coded in the JOB statement. On the other hand, COND is coded on the EXEC statement if the conditions are specific to certain steps only. Helps in executing the job depending upon the return code which is generated by the system after the execution of job steps.
25
Introduction to JCL
64
25
Introduction to JCL
65
25
Introduction to JCL
66
TIME
The TIME parameter sets a CPU time limit for an entire job when it is coded on the JOB statement. Minutes may range from 1 to 1440 and seconds less than 60.
If the elapsed CPU time within a job exceeds the time limit for that job, the entire job is abnormally terminated with a return code of 322.
TIME coded on the EXEC statement overrides the limits set by job statement entry.
25
Introduction to JCL
67
25
Introduction to JCL
68
REGION coded on the JOB statement sets the limit for all steps, overriding any region size on EXEC statement.
n in the REGION parameter is the number of 1024-byte. If a job requires more storage than was specified by REGION, the job is abnormally terminated with an 804 completion code.
25
Introduction to JCL
69
25
Introduction to JCL
70
EXEC Statement
25
Introduction to JCL
71
Each job step begins with an EXEC statement that either names the
program to be executed or invokes a cataloged procedure. A job can contain several EXEC statements. There may be as many as 255 EXEC statements in a job. Each one of these is followed by DD statements defining the data sets required by the job step.
25
Introduction to JCL
72
//Stepname EXEC Procedure PGM=program,Key-word Parameters //Step1 //Step2 EXEC EXEC SORT5 PGM=L1, PARM=12345
//Step3
EXEC
PGM=IEFBR14
25
Introduction to JCL
73
A step name is required if subsequent JCL statements refer to the job step or if you wish to restart the job from that step.
25
Introduction to JCL
74
Programs can reside in a system library named SYS1.LINKLIB, in temporary libraries and in private libraries.
If the program is not found in the libraries, the system abnormally terminates the job with an 806 completion code.
25
Introduction to JCL
75
25
Introduction to JCL
76
A system library named SYS1.LINKLIB contains all the IBMsupplied system programs, such as compilers, linkage editor and service programs. A program in SYS1.LINKLIB is executed by naming the program on the EXEC statement.
Private program libraries are created as output from the linkage editor.
Programs within a library must have unique names.
A private program is executed by either including a special JOBLIB DD statement or STEPLIB DD statement.
25
Introduction to JCL
77
//ABC123 JOB (2347)GOLD,CLASS=A //JOBLIB DD DSN=TRGID.LINK,DISP=SHR //STEP1 EXEC PGM=IEFBR14 // : // : // : //EXECUTE EXEC PGM=P1
25
Introduction to JCL
78
In the example given we have defined 2 private libraries ABC001.PGMLIB and ABC001.LINKLIB
Programs in these steps are first searched in the private libraries given in the order in which it is defined. If not found, the system searches SYS1.LINKLIB for the program.
25
Introduction to JCL
79
EXEC
PGM=LINK1
EXEC
PGM=IEBGENER
25
Introduction to JCL
80
STEPLIB DD statement, similar in form and function to the JOBLIB statement, is placed after an EXEC statement. It is effective for that step only. It can be placed in a catalogued procedure. If JOBLIB and STEPLIB DD statements are both included in a job, the STEPLIB statement overrides the JOBLIB statement.
25
Introduction to JCL
81
EXEC
PGM=PRINTX
25
Introduction to JCL
82
The Key-word parameters are coded on the EXEC statement following the program or procedure. It is applied only on the step being executed. The PGM parameter must appear first.
25
Introduction to JCL
83
PARM
ACCT
COND DPRTY REGION TIME ADDRSPC PERFORM
25
Introduction to JCL
84
It is used to pass control information to the job step when the step is initiated. This can be extremely useful for passing run-time information to an application program. There may be 1 to 100 characters of data in the PARM.
If the value consists of several sub-values separated by commas, or if it contains special characters, enclose the value in apostrophes. Code the legitimate apostrophe as two consecutive apostrophes.
Programs supplied by IBM such as the compilers and linkage editors, expect the value to represent various run options. If we have to pass values to a COBOL program, it should have the Linkage Section through which it receives the value.
25
Introduction to JCL
85
PARM = Value
PGM=ONE,PARM=(K=6,I=3,J=4) COB2UCLG,PARM.GO=STRING
25
Introduction to JCL
86
Any accounting information for job steps must be defined by the installation. It may have one or more sub-parameters separated by commas. If it contains any special characters, enclose the sub-parameters in apostrophes. If coded in the EXEC statement, it overrides the JOB statement.
25
Introduction to JCL
87
ACCT = (accounting information) //STEP10 //COMP EXEC EXEC PGM=ONE, ACCT=(3784,45-96) PGM=L1,ACCT=24573
25
Introduction to JCL
88
If the step name is not given in the condition, the number is compared against the return code from each prior step. If the condition is true the step is bypassed. If the step name is given in the condition, the number is compared against the return code of a specific step. If more than one condition is specified all of them are checked. A maximum of 8 conditions can be checked in any one step.
25
Introduction to JCL
89
COND=(number,comparison) (or) COND=(number,comparison,stepname) //STEPA EXEC PGM=ONE,COND=(4,GT) //STEPAA EXEC PGM=TWO,ACCT=14578,COND=(8,EQ,STEPA) //STEPB EXEC PGM=TWO,PARM=4567,COND=((4,GT),(6,LT))
25
Introduction to JCL
90
COND Parameter and its Sub parameters Click to edit Master title style
If a step is not executed, it does not return a return code. If a subsequent step tries to test the return code from a step that was not executed, the test is simply not performed. If a step abnormally terminates, no return code can be issued and all subsequent steps are bypassed, unless the EVEN or ONLY subparameters are used. COND=EVEN permits the job step to execute even if previous steps abnormally terminate. COND=ONLY causes the step to execute only if the previous step abnormally terminates.
25
Introduction to JCL
91
COND Parameter and its Sub Parameters Click to edit Master title style
25
Introduction to JCL
92
Introduction to JCL
93
REGION=nK/nM
//COMPU
//CALC
EXEC
EXEC
PGM=GO,REGION=1000K
PGM=PGM1,REGION=1M
25
Introduction to JCL
94
If the elapsed CPU time within a step exceeds the time limit for that step, the entire job is abnormally terminated with a 322 completion code.
25
Introduction to JCL
95
TIME=minutes TIME=(minutes,seconds)
TIME=NOLIMIT
TIME=MAXIMUM //STEP5 //STEP8 EXEC PGM=FIRST,TIME=(10,3) EXEC PGM=LAST,TIME=8
25
Introduction to JCL
96
Prevents a job step from being paged. ADDRSPC=REAL locks the step into central storage during creation. ADDRSPC=VIRT allows the step to be paged. This is the default.
25
Introduction to JCL
97
ADDRSPC=VIRT/REAL
//STEP10
EXEC
PGM=ABC,ADDRSPC=REAL
25
Introduction to JCL
98
The THEN and ENDIF are always required. The ELSE is optional.
JOB, JCLLIB or JOBLIB statements cannot follow a THEN or ELSE. Mnemonic operators that can be used are NOT, EQ, NE, GT, LT, GE, NL, LE, NG, AND, OR. The NOT operator can be coded outside of the left parenthesis to reverse the result of relational expression.
25
Introduction to JCL
99
25
Introduction to JCL
100
25
Introduction to JCL
101
DD Statement
25
Introduction to JCL
102
Syntax:
//ddname DD positional/keyword parameters
Rules for coding DD statement: The ddname identifies the name of the data definition statement. A valid ddname must be assigned to each dataset used. DD name must be 1 to 8 alpha numeric or National (@, $, #). The first character must be alphabetic or national.
25
Introduction to JCL
103
25
Introduction to JCL
104
* DATA DUMMY
Keyword parameters may also be coded in the operands field. The following are the most commonly used. DSN DISP UNIT SPACE VOLUME LABEL DCB
25
Introduction to JCL
105
Data set names that are referred back will take the format as below : DSN=*.stepname.ddname
25
Introduction to JCL
106
Introduction to JCL
107
25
Introduction to JCL
108
2) By Coding the DSN parameter In this case the dataset name must start with two ampersands (&&) followed by 1 to 8 characters alphanumeric or national characters. The first character must be alphabetic or national. Example:
//JOB1
//STEP1 //DATA1
Introduction to JCL
Introduction to JCL
110
Introduction to JCL
111
UNCATLG
Introduction to JCL
112
25
Introduction to JCL
SPECIFICATION OF DEVICE GROUP: A device group name is symbolic name which is assigned to a group of devices when the system is generated. Devices are often grouped together based on their function. For example, you can have all direct access storage devices are under one group SYSDA, tape devices are under one group SYSTAPE, and temporary 25 storage devices are under one group SYSTEMP and so on.
Introduction to JCL
114
25
Introduction to JCL
115
VOl=SER=(volume, . . . . ,volume)
VOL=SER=XT4321 VOL=SER=PACK02
25
Introduction to JCL
116
25
Introduction to JCL
117
Sequence-number Tape datasets can be identified by their sequence number. The sequence number is a 4 digit number and describes the datasets position relative to other dataset that may exist on the volume. This number can range from 1 to 9999, Where number 1 indicates the first dataset on the tape. If this parameter is not Coded it defaults to 1.
Type-of-label Type of label can be SL (Standard IBM Label), NSL (Non Standard Label, also called user defined label), SUL ( LABEL=RETPD=140 LABEL=EXPDT=20230
25
Introduction to JCL
118
Space may be requested in tracks, cylinders or blocks. Primary is the number indicating the amount of storage space requested. Secondary is the number indicating the amount of storage space requested in case of primary space allocated is insufficient. The Secondary space can be allocated 15 times. Directory is the number indicating the amount of storage space for recording of name and location of members created with in the partition dataset. One directory block contains 256 bytes.
25
Introduction to JCL
119
Introduction to JCL
120
The RECFM parameter is used to specify to the operating system, the record format of the dataset being created. Record format can be of a fixed length (F OR FB), variable length (V OR VB), or undefined (U) length. The LRECL parameter is used to specify the length of the record for fixed and variable length records. For fixed length records, LRECL is set to equal to the record length since all the records are in same length. For Variable length records, LRECL is set to equal to the size of largest record 25 plus four bytes. The first four bytes of the each record will have control information
Introduction to JCL
121
BLKSIZE can not be larger than the track size of the direct access volume on which the data will reside.
25
Introduction to JCL
122
Introduction to JCL
123
25
Introduction to JCL
124
Introduction to JCL
125
25
Introduction to JCL
126
SYSPRINT, SYSABEND, SYSUDUMP DD names DCB Parameter Click to edit Master title style
SYSPRINT is a special DD name that directs the output either to a file or to various output devices. SYSUDUMP is a DD name which provides a formatted dump of the program area in hexadecimal, including the contents of registers, a trace back of sub-routines called, and information about all the data sets used.
The SYSABEND DD name additionally dumps the system nucleus the resident portion of the Operating System. This parameter is only used for system programmers.
A dump results only if the step abnormally terminates.
25
Introduction to JCL
127
25
Introduction to JCL
128
The lines of data cannot contain // or /* in columns 1 and 2 if DD * is used. If the lines contain // and /*in columns 1 and 2, code DATA in place of *.
//ddname // // /* //ddname // // /* DD * : :
DD : :
DATA
25
Introduction to JCL
129
Syntax:
//ddname Examples: //JOB1 //STEP1 //FILE1 //SYSPRINT DD SYSOUT=CLASS JOB A123,THIRU,CLASS=K,MSGCLASS=A EXEC PGM=PGM1 DD DSN=ABC.DEF.GHI,DISP=SHR DD SYSOUT=*
25
Introduction to JCL
130
NULL statement indicates the end of the job. Any statement after this statement is ignored.
// [two slashes indicate the NULL Statement]
//MYJOB // : // : //MYFILE // JOB . . . . .
DD . . . . . .
25
Introduction to JCL
131
PROCEDURES
25
Introduction to JCL
132
Introduction to JCL
133
Catalogued and In stream Procedures Click Procedures to edit Master title style
Introduction to JCL
134
Example:
// EXEC ADDPROC
25
Introduction to JCL
135
Procedures can contain all but the following JCL statements : JOB, delimiter (/*) or null (//) statements JOBLIB statements DD * or DATA statements
25
Introduction to JCL
136
Introduction to JCL
137
25
Introduction to JCL
138
Introduction to JCL
139
If a positional parameters are coded as symbolic then a period should be inserted between them. This period is in addition to any periods that would be required for the correct syntax of the statement that is being coded.
Symbolic Parameters cannot be concatenated with other symbolic parameters to produce yet another symbolic parameters. However they can be concatenated with each other, each retaining the value originally assigned to it.
25
Introduction to JCL
140
25
Introduction to JCL
141
25
Introduction to JCL
142
25
Introduction to JCL
143
25
Introduction to JCL
144
25
Introduction to JCL
145
//JOB1 JOB A123,THIRU //PROCLIB JCLLIB ORDER=A.B.C,DISP=SHR //PROC1 EXEC PROC123 //STEP1.DD1 DD DSN=FILE3,DISP=OLD //STEP2.DD2 DD DSN=FILE4,DISP=SHR
25
Introduction to JCL
146
Generation Generation Data Group ClickData Group to edit Master title style
A GDG is a Data Group is a group of datasets which are related to each other chronologically and functionally. All the datasets with a GDG will have the same name. The generation number of a dataset with a GDG is automatically assigned by the operating system when it is created. The Syntax of the generation number is GaaaaVnn Where G is for generation, aaaa is absolute sequence number can range From 0000 to 9999, V is version and nn is a version number can range from 00 to 99
25
Introduction to JCL
147
25
Introduction to JCL
148
UTILITY Programs
25
Introduction to JCL
149
25
Introduction to JCL
150
These utilities are executed by the same general JCL statements //stepname EXEC PGM=program-name //SYSPRINT DD SYSOUT=A { prints the utility messages } //SYSUT1 DD . . . {If needed, describes an input data set} //SYSUT2 DD . . . {If needed, describes an output data set} //SYSIN DD * {control statements} /*
25
Introduction to JCL
151
Introduction to JCL
152
25
Introduction to JCL
153
The INREC and OUTREC statements INREC OUTREC FIELDS = ( [constant , ]position, length[,align,])
25
Introduction to JCL
154
Introduction to JCL
155
IEFBR14 is used to create, catalogue, uncatalogue or delete a data set. A new data set can be created by specifying DISP=(NEW,KEEP) or DISP=(NEW,CATLG) An existing data set can be deleted or uncatalogued by specifying DISP=(OLD,DELETE) or DISP=(OLD,UNCATLG)
//STEPNAME1 EXEC PGM=IEFBR14 //DDNAME1 DD DSN= ABCDATA.DATA.SET,DISP=(MOD,DELETE)
25
Introduction to JCL
156
The IDCAMS (also know as Access Method Services) is a versatile Utility that can be invoked in batch mode with JCL or interactively with TSO commands. This utility can be used to perform the following functions o Create/delete GDG Bases or VSAM objects o Load and Unload VSAM datasets o Listing Catalogue Information o Copy datasets o Modify attributes of datasets
Introduction to JCL
157
Introduction to JCL
158