JCL
JCL
CHAPTERS
1) Introduction to JCL
2) Coding JCL
3) The JOB statement 4) The EXEC statement 5) The DD statement 6) More on DD statement 7) Utility programs 8) Procedures
contd..
Interactive work
User
OS
d
Printer Eg. Payroll report
BCP
OS
Storage device Eg. ATMs
d
Normally scheduled to run when no interactive processing takes place. But when run concurrently with interactive tasks, batch work are typically given low priority by the OS.
BCP
Interactive users
JES provides the interface between the BCP and the batch processes. d
VTAM provides the interface between the BCP and interactive users.
What is a JOB ?
The Batch process is called JOB. To render the Job to the OS we use Job Control Language (JCL).
Job2
JES BCP
Job3
(Execution of Subsystem programs to start TSO, CICS environments
JOB - carries the Job name, the type of job //DSRC062 JOB CLASS= type of job
EXEC - carries the program name //STEP1 EXEC DD PGM=Load modules name DSN=Dataset name
10
contd
//. d
DD
11
Job2
(Execution of Application programs, by another user)
JES BCP
d Job3
(Execution of sub-system program to start TSO, CICS environments
12
J E S
d
Input queue
BCP
Execution
Output queue
13
You code JCL with TSO and SUBMIT your JCL into the system for processing
You can view the output of your Job using TSO before redirecting the output to the desired destination Disk, Tape or Printer.
J E S
d
Input queue
BCP
Output queue
Submit
14
JES gives each job a JOB ID which you can view and
Queues the jobs in the Input queue based on the jobs CLASS coded in the JCL.
Input queue Class E I Job ID Submit
J E S BCP
Output queue
View / Purge
15
contd..
Installations establish different Class codes based on the importance or type of job.
Class F for express jobs which use little CPU time Class P for jobs requiring lots of CPU time and run at some scheduled time Class E for jobs that run in the evenings only Class I for jobs to be run immediately A Class for jobs that use Tapes A Class for jobs that run CICS or IMS system programs and so on
16
contd..
JCL that is correct in syntax remains in the Input queue. JCL with errors goes to a different disk dataset called Output queue, which also contains the execution results of successfully executed jobs.
Input queue
E I
J E S
Output queue
BCP
17
18
19
Program Initiators picks jobs for execution based on the jobs CLASS.
J E S
d
Input queue Initiators D 1 E 2 E 3 I 4 I P Output queue
BC P
20
contd
Each Initiator is governed by its own list of Job Classes based on which it preferentially picks jobs for execution from the input queue.
J E S
Input queue Initiators Class-List D 1 E E 2 PI E 3 IA I 4 F I P
Job ID
BC P
Output queue
21
22
J E S
Input queue E E P Output queue
BCP
NOTIFY (When done)
Job ID
View / Purge
23
messages
24
Indicated by MSGCLASS on Job statement for Reports Indicated by SYSOUT on DD statement for Programs output Input queue Class A E
J E S
BCP
A B X or T
E
Job ID
View / Purge
25
Versions of JES
JES comes in two versions:
JES2 which most Mainframe computer systems use JES3 which are used by large networks of Mainframe computers
26
//
JOB
Notify=TSO-UserID
27
contd..
JES3
//
JOB
Based on the command, the JES control statements are coded before or after the JOB statement.
28
29
A component of TSO called ISPF (Interactive System Productivity Facility) provides a full screen editor to create source program statements and JCL.
You also use TSO to see the results after processing, using SDSF (Spool Display and Search Facility), a software product d you can access from TSO.
30
ID Name
//DSRC012A //STEP010
Operation
JOB EXEC
Operands
NOTIFY=DSRC012 PGM=LM of program
Comments
The Job The Step
//DD1
//d
DD
DSN=Dataset name,Space=.,DISP=SHR,x
31
ID Name
//DSRC012A //STEP010
Operation
JOB EXEC
Operands
NOTIFY=DSRC012 PGM=LM of program
Comments
The Job The Step
//DD1
//d
DD
DSN=Datasetname,Space=.,DISP=SHR,x
32
contd..
JOB EXEC
The Job..
//SYSIN
/*
DD
The DD..
Instream data //
a JCL statement if
// /*
//* in columns 1, 2, 3
33
contd..
JOB EXEC DD
//
DISP=SHR
1 to 8 alpha-numeric (A-Z,0-9) or national characters (#, @, $). First character must be alphabetic or national. Must be followed by at least one blank space.
34
contd..
JOB EXEC DD
d Operation field must be coded from or after column 12 onwards It indicates the type of control statement (JOB, EXEC or DD).
35
contd..
71
JOB EXEC DD
DSN=Dataset name,DISP=SHR
//
36
contd..
71
The Comment field can be coded after the operand field, up to column 71 d
Must not be used unless there is an operand field and must follow the operand field Must be preceded by at least one blank
Note : The Comment field is different from Comment statement (//*); though they both serve to code comments.
37
Coding JCL statements - Continuation of Statements Continuation of the Parameter field on to the next line
//DD1 //
DD
d
//DD1 DD
DSN=Dataset name,Space=.,DISP=SHR,x
//
DCB=..
38
39
Purpose
Marks the beginning of a work load (job) to the OS. Supplies the necessary information and instructions to the OS
Gives the job a name Instructs the OS the importance of the job relative to other
jobs
Informs who will pay for the CPU time the job uses
40
Programmers name.
MSGCLASS,MSGLEVEL,
RESTART,TIME, TYPRUN ADDRSPC, REGION among others.
d Example:
//DSRC012A // JOB (012,John), NOTIFY=DSRC012,CLASS=A,PRTY=15, MSGCLASS=T,MSGLEVEL=(1,1)
41
Positional parameters
Keyword parameters
Must follow positional parameters Within a list, can be coded in any position Absence within a list need not be indicated by comma
42
Example :
//DSRC012A JOB (012)
43
44
night only A job updating a database Is a type of job which is I/O bound and to be run immediately
A job generating reports
45
contd..
d Example :
//DSRC012A
of the day
JOB
(012,John), NOTIFY=DSRC012,CLASS=E
46
contd..
Operator can change the CLASS even after the job is submitted.
Operator can also reconfigure Initiators to pick Classes other than what the initiator was originally configured to pick.
47
48
contd..
JOB JOB
CLASS=E,PRTY=1 CLASS=E,PRTY=15
49
contd..
If jobs wait in the queue under the same CLASS and same PRTY, then the jobs are picked for execution based on FIFO.
JOB 1 2 3 CLASS E E E PRTY 1 13 13
50
Your job can get the CPU prior to the other jobs.
51
Minutes range from 1 through 357912 (248.55 days) Seconds range from 1 through 59
implies maximum CPU time for this JOB is 1minute and 30 seconds.
TIME=(1,30)
System will abend the job with a system completion code of 322, if the specified TIME is exceeded.
52
contd..
While testing a new program which may go into a loop, unless it is timed out automatically (system code 522)
Special jobs which need to by-pass any TIME limit barrier and which must not be timed out too
Syntax of TIME=1440 or NOLIMIT takes off any CPU time limit
and lets the job run continuously. This job will not be timed out.
Syntax of TIME=MAXIMUM permits maximum CPU time for a job - 357912 minutes.
53
contd..
maximum CPU time for this JOB is 2 minutes maximum CPU time allowed is 2 seconds JOB NOTIFY=DSRC012,TIME=(,50)
54
Syntax is REGION=nK
nM
d If not coded, a system default or installation defined The system allocates the storage above and below the 16 MB line Example:
//DSRC012A //DSRC012A JOB JOB REGION=4092K same as coding REGION=4M
55
contd
If the job requires more storage than what it requests, the system returns a completion code of 804 or 80A.
56
REAL locks the job in central storage during execution VIRT, the default, lets the job be paged
Use REAL only for time-dependant programs and those that dynamically modify channel programs during I/O operations.
Example:
//DSRC012A JOB ADDRSPC=REAL
57
Requests that the OS sends a message about: the Jobs completion and
its completion status whether normal or abnormal
58
contd..
59
60
contd
To notify someone (userid) not at the jobs origin, code the JES2 NOTIFY node control statement
Example: /*NOTIFY node.TSOuserid
//DSRC012A JOB CLASS=E,<other parameters>
d
Code NOTIFY=&SYSUID, if you share your JCL and want that user submitting your JCL to get notified Users need not change your code the NOTIFY value
61
TSO.
include:
The JES2 JOB LOG stating whether the job was run
the JCL submitted is listed (with the JCL statements numbered by the OS).
62
contd
the I/O devices and datasets allocated for each job step
memory allocated for each step the CPU time taken to execute each step a completion code - COND CODE/ System completion code, which
The final messages states the CPU time taken to run the entire job
(all steps).
63
contd..
Example:
//DSRC012A JOB CLASS=E,MSGCLASS=T
64
Syntax is MSGLEVEL=(JCL,Allocations)
d JCL - takes values 0 or 1 or 2
0 1 2
print only JOB statement print all user-coded JCL plus procedure JCL statements print only user-coded JCL statements
65
contd..
print all the allocation messages only if the job ends abnormally print all the allocation messages whether the job ends normally or abnormally
Default MSGLEVEL=(1,1)
Example:
//DSRC012A JOB MSGCLASS=T,MSGLEVEL=(1,0)
66
to give your JCL a syntax check or to hold your job for later execution
Your job does not run; resources are not allocated. The syntax error messages are routed to the output queue and can be viewed.
67
contd..
To print your JCL to a printer without running the job use TYPRUN=COPY; ensure you assign a printer class to MSGCLASS
Example:
d //DSRC012A
JOB
NOTIFY=DSRC012,TYPRUN=SCAN
68
Syntax is
Example:
JOB EXEC
EXEC
69
70
Purpose
(Certain programs like the language compilers which perform the same function for all its users, are converted to a form called PROCEDURES)
71
Optional, but useful for referbacks and locating errors in the jobs reports
//Step010 //DDIN
EXEC DD EXEC
//Step020
//Step030
EXEC
72
73
contd..
If the load module is not found, the system will abend the step giving a completion code of 806.
Example:
//DSRC012A JOB
EXEC EXEC EXEC
NOTIFY=DSRC012
PGM=Load Module of Your Program PGM=SORT (the LM of Utility Program) PROC=Procedure Name
d //STEP1
//......... //STEP2 //............. //STEP3
74
PGM=Igycrctl
PGM=Hewl,COND=(4,LT,COBOL)
d //..
//Lked
Interpretation: If Condition is satisfied, Do Not Execute the Step If Condition is not satisfied, Execute the step.
75
contd..
This condition tells the OS that If 4 is less than the value of the condition code of the compiler step, then, shut off the execution of the link-edit program. This will be true if the d compiler sets its condition code to 0005 or greater.
76
contd..
To define conditions under which you want a step of a normally executing job to be shut off. You code this in the form COND = (4,LT,StepName) or COND=(4,LT)
To tell the OS to process a step even if a previous step in the job has already abended, or, only if a previous step abended. Ordinarily, the OS would throw out the whole job when a step abends and ignore all steps that follow. You code this in the form COND=EVEN or COND=ONLY.
77
contd..
COND=(Condition code value,Comparison operator,Stepname) COND=(Condition code value, Comparison operator) Condition code value - 0 to 4095.
78
contd..
Condition code values in the range 0 to 4095 leaves a job still in the normal mode, not the abnormal mode. Abnormal mode (or Abend) is indicated by a three position hexadecimal value:
806 Load module not found
80A
d OC7
79
contd..
CC 0000 Program execution was completely successful CC 0004 Execution was OK but caused warning messages CC 0008 Program execution was seriously flawed
80
contd..
81
contd..
//Step020 Exec Pgm=B2222,Cond=(0,LT,Step010) Pgm B2222 is not executed if pgm A1111 returns any CC > 0000 //Step030 Exec Pgm=C3333,Cond=(0,Eq,Step010) Pgm C3333 is not executed if pgm A1111 returns CC 0000
82
contd..
CC 0000
CC 0004 Step not run because of CC CC 0004 Step not run due to Cond=Only
Abend SoC7
Execution blocked by Abend
CC 0000
CC 0000
83
contd..
The step is executed for CC 4,5 and 6 and not for 0 to 3,7 and
above.
Note : The OS always wants to by-pass steps to lessen its work.
84
contd..
A maximum of 8 conditions may be checked in any one step (EVEN & ONLY count as one)
Omitting stepname in the condition, will apply the test to all preceding steps If one of the steps being checked was not executed, its condition check is ignored
d
If a Condition is not coded for a step and its previous step abends, then this step is by-passed.
85
contd..
Whatever the Condition coded, the system bypasses subsequent steps when :
a JCL error is encountered (syntax error,datasets not found) Datasets allocation error Job enters an Abend mode, unless Cond=Even or Only is coded Operator cancels the job
86
87
contd
//Name ELSE
// Step to processed when relational expression is false //Name ENDIF d
Name field is optional. Operation fields are IF,THEN, ELSE and ENDIF.
ELSE is an optional clause. ENDIF marks the end of the statement.
88
contd
>
Connect operators - AND, OR
= >= <=
&
NOT () operators
Keywords:
Indicates Return code Indicates occurrence of Abend Indicates non occurrence of Abend Indicates a specific system or user abend code Indicates execution of the specified Step Indicates non execution of the specified step & Step020.RUN) THEN..
89
contd
Indicates that the relational expression tests a Return Code. Code (stepname.RC, a comparison operator, a RC value) or code (RC, a comparison operator, a RC value)
IF (Step040.RC EQ 4) THEN ..
RC values range from 0 to 4095 since this is the syntax in normal mode. ABEND or (ABEND EQ TRUE)
90
contd
System completion code (S followed by hexadecimal value of 3 digits) User defined completion code ( U followed by decimal value of 4 digits) IF (ABENDCC EQ SOC4) THEN IF (ABENDCC EQ U0100) THEN.. (Stepname.RUN) or (Stepname.RUN EQ TRUE) stepname) has been executed.
d Indicates that the relational expression tests that the specified step (vide
91
contd
Use parantheses in compound expressions to make the system evaluate the relational expression in the order in which you want; else, the order of evaluation will be: d First the NOT operator followed by
// //
92
// // //
contd
//STEP060 //STEP070
//
ENDIF
EXEC PGM=Program TWO
93
94
contd..
If you specify time both in the JOB and EXEC statement, then the time parameter on the EXEC applies for that step and the remaining time limit from the JOB statement is available to the other steps.
//DSRC012A //Step1 //Step2 JOB EXEC EXEC TIME=(1,50) PGM=PROGRAM1,TIME=(0,30) PGM=PROGRAM2
d
//DSRC012A JOB TIME=(1,50)
//Step1
//Step2
EXEC
EXEC
PGM=PROGRAM1,TIME=(1,50)
PGM=PROGRAM2
95
contd..
The limit on the JOB totals to the CPU time usage of all the steps.
//DSRC012A
//Step1 //Step2
JOB
EXEC EXEC
TIME=(1,50)
PGM=PROGRAM1,TIME=(1,50) PGM=PROGRAM2,TIME=(1)
dNote: The OS ignores any limit on the EXEC which is larger than that
coded on the JOB statement.
96
Region=nK or nM
EXEC
EXEC
PGM=SORT,REGION=5M
PGM=Load Module,REGION=3M
d//.
//...
97
contd
If REGION is coded on the JOB and EXEC, then the JOB limit overrides any REGION that is larger
//DSRC012A //Step1 //. JOB NOTIFY=DSRC012,REGION=2M
Each step gets only 2M of storage
EXEC
PGM=SORT,REGION=5M
//Step2
EXEC
PGM=Load Module,REGION=3M
//...
IF no REGION is coded, system default value or installationd defined default. If a program requires more storage than coded, step fails with a system completion code of 804 or 80A.
98
The passed data can be: d received by the program - through the programs Linkage section and used in the program - if Procedure division using Linkage sections data- area is coded. 99
contd
//STEP010 EXEC PGM=Load Module,PARM=001 JOHN 2) Access the data in a Cobol program: IDENTIFICATION DIVISION. DATA DIVISION.
LINKAGE SECTION.
d01 PARM-DATA-AREA.
05 PARM-LEN PIC S9(4) COMP.
05 PARM-DATA1.
10 DATA1-IN X(100). PROCEDURE DIVISION USING PARM-DATA-AREA. DISPLAY DATA1-IN.
100
contd
Use apostrophes around the passed data if the data consists of a space
PARM=001 JOHN
If passed data comprises an apostrophe or an ampersand, code two such characters consecutively.
PARM=Hello World PARM=ABC&&4
To continue coding data on the next line, code a comma and continue. Also coding apostrophes around continued data is a must. Comma gets included in the byte count.
PARM=001,
JOHN
To code till column 71 and then continue, leave column 72 blank and continue on the next line from column 4 through 16
101
102
The DD statement
DD stands for Data definition.
Defines to the OS, information about the Dataset(s) which the executing program uses:
//. //.. JOB EXEC . PGM=LM of a program
//DDname1
DD
DD
//DDname2
103
The DD Statement
contd..
DD
DD
//
//
104
The DD Statement
contd..
105
What is a Dataset ?
A store of data Employee data, Customer data.
Each entitys data (Employee say) is called a RECORD. Many such records form the Dataset. Types of Datasets used in Mainframes today :
Broadly based on arrangement of records inside the dataset -
DSRC012.Empdata DSRC012.Empdata(Member1)
106
Each disk volume has a unique name called Volume Serial number.
107
contd..
Recorded on each disk volume is the VTOC which is a dataset to keep track of all datasets stored on that volume.
108
109
contd..
110
Mandatory. If omitted, the dataset is concatenated with the one defined in the previous DD statement.
*
Data Dummy or NullFile
Volume,
Space, Dcb Sysout
111
The DD statement - *
Marks the beginning of Instream data to a load module.
Can be compared to passing data to a load module using the PARM parameter on the EXEC statement.
Format :
//STEP010 EXEC DD PGM=LM of a program *
d //DDname
/*
<..Instream data..>
112
The DD statement - *
contd..
IDENTIFICATION DIVISION. DATA DIVISION. WORKING-STORGAE SECTION. 77 DATA1-IN PIC X(80). PROCEDURE DIVISION. ACCEPT DATA1-IN.
113
The DD statement - *
contd..
The end of data is indicated by the delimiter - /* The instream cannot contain // as data in columns 1,2 when * is used.
114
EXEC
DD
PGM=LM of a program
DATA
115
Under such situations delimit vide the DLM parameter which indicates the new delimiter to be used. DLM can be used for * and DATA
//SYSIN /*abc.. $$ DD DATA, DLM=$$
116
Any I/O requests on the dataset is bypassed No devices and space is allocated to the dataset
117
contd..
An attempt to read a dummied dataset results in an EOF exit; A write request in the program is ignored.
For Utility programs, used to cut-off control statements (instream data) to the program
//Step1 // //SYSIN
EXEC
DD
PGM=IEBGENER
DUMMY
118
DSN - Dataset Name - DSRC012.ITC.PGMS. DISP - Status of the dataset - New or Existing. UNIT - Hardware device where the dataset resides Disk or Tape. VOL - Identification of the disk or tape. SPACE - Amount of space required by the dataset on the disk. DCB - Data Control Block information of the dataset.
//DDname
DD
DSN=<Dataset name>,
DISP=SHR
//
119
120
contd..
Temporary datasets are used as work areas within a job; they last only for the duration of the job. A Temporary dataset name starts with && followed by 1 to 6 characters - DSN=&&TEMPRY
Absence of DSN coding also denotes a temporary dataset.
121
contd..
DSN=DSRC12.EMP.DEVL
If the dataset (DSN) is not found in the system catalog, the system throws a JCL error. d Dataset names (DSN) cannot be duplicated in the VTOC. If duplicated, the system returns a CC of 8.
122
Status specifies the existence of a dataset at the start of the step (not start of the job) - whether NEW, OLD, MOD, SHR
NEW specifies that the dataset is new and does not exist when the
step begins.
OLD specifies that the dataset exists when the step begins.
123
contd..
Normal termination disposition specifies what the OS must do to the dataset if the step terminates normally whether to CATLG, UNCATLG, PASS, KEEP, DELETE
CATLG specifies that the OS must record information about the
dataset like its Name, its Unit, Volume identifier in the system catalog when it is newly created or, update the entry if existing. You cannot catalog a temporary dataset.
KEEP specifies to the OS that newly created datasets need not have a catalog entry but just be retained on the volume.
UNCATLG specifies that the OS removes all entries from the catalog, but retain the dataset on the volume.
PASS specifies to the OS that subsequent steps will access the dataset and that the dataset need not be cataloged (if new) or the
catalog entry need not be updated (if existing). Can PASS PS and PDS but not VSAM datasets. Common to code DISP=(NEW,PASS) when you create a temporary dataset.
DELETE specfies to the OS that the dataset must be uncataloged and deleted from the system when the step ends normally. 124
Abnormal termination disposition specifies what to do with the dataset when the step terminates abnormally - whether CATLG, UNCATLG, KEEP, DELETE.
Note: For SMS managed datasets, KEEP always reverts to CATLG, since all SMS managed datasets must be cataloged.
125
contd..
To create a new member of an existing PDS, code DISP=OLD or SHR, not NEW, since DISP refers to the partitioned dataset as a whole not to the member. The PDS directory is updated to know about the new member. VSAM datasets and DISP
Code DISP=OLD or SHR only for DD statements that access a VSAM dataset. d
126
contd..
DELETE)
to append records, code MOD.
DELETE)
127
(or)
128
contd..
//DDB
DD
DSN=.
//
UNIT=3480
129
Every I/O device (Disk drive, Tape drive, Printer, Terminal) has a unique label called Hardware Address The OS communicates with these devices using their addresses You can specify where to store your dataset using these Addresses, represented by three hexadecimal characters D5A, A58, 0C4. EXAMPLE:
//DD8 DD DSN=DSRC012.New.DS,
//
//
DISP=(NEW,CATLG,DELETE),
UNIT=A58
130
contd..
IBM convention for every item it manufactures Disks carry Model Numbers like 3390, 3380 Tapes carry numbers like 3490, 3480. Printers and all other I/O devices carry an IBM convention. The OS maintains a list of addresses for each Model number.
d EXAMPLE:
//DD8 // // DD DSN=DSRC012.New.DS, DISP=(NEW,CATLG,DELETE), UNIT=3390
131
Installations group hardware addresses of similar devices destined for a specific purpose (production-preferred high speed disk drives, or drives to store test datasets) and give a unique name to each group. Say, addresses of disk drives for some specific purpose are listed under a group named SYSDA. The OS selects any available disk from the group list SYSDA, to store the dataset. //DD8 // // DD DSN=DSRC012.New.DS, DISP=(NEW,CATLG,DELETE), UNIT=SYSDA
Symbolic names facilitates smooth phasing-in of newly added devices, by adding their addresses to a group list. (The JCL code need not be changed). 132
contd..
Represents the storage disk that the OS uses for its virtual storage operations.
//DD8 // // DD DSN=DSRC012.New.DS, DISP=(NEW,CATLG,DELETE), UNIT=VIO
133
contd..
Along with UNIT, we can specify the number and name of the VOLUME of that Unit required.
VOLUME is the name of a specific UNIT. One unit can have many volumes. Say, a disk unit 3390 can have many volumes named Pack01, Pack02. And a tape unit can have many volumes named 038272, 013267, 020133.
Syntax:
d UNIT=(3390,2),VOL=SER=(PACK01,PACK02)
where PACK01 and PACK02 are the names of the two volumes of 3390 disk unit.
For SYSDA, Volume is not applicable. The OS selects any available disk from the list SYSDA.
134
contd..
(Unit need not be coded for existing Cataloged datasets since the OS can locate the dataset from the System Catalog).
If your dataset is to be sent to a Printer or Terminal, code SYSOUT instead of UNIT.
135
contd..
3390
3391
ZTSO01
ZRSO06
For SMS managed datasets, defaults to STORAGE CLASS: Storage Class SCTSO Unit 3390 Volume ZTSO03
136
contd..
If you forget to code DISP at the dataset that you are reading, //DDRd DD DSN=DSRC012.OLD.DS
you will get an error message SPACE NOT SPECIFIED FOR DATASET or INCORRECT DEVICE TYPE SPECIFIED.
d
Correct this problem by coding DISP=SHR that you forgot, not UNIT. You will get this same error message if you code an incorrect UNIT with a Cataloged dataset.
137
S1 - the Unit of space in Cylinders(CYL),Tracks(TRK), Blocks of records(a number representing block size), Record length S2 Primary (initial) quantity of units S3 - Secondary quantity of units if primary is exceeded; but allocated only when the dataset expands. (S3 X 15 or 16 or 123 secondary allocations - called Extents) S4 - Number of Directory blocks (applicable for PDS only)
EXAMPLE: SPACE=(TRK,(5,2))
138
contd..
139
contd..
Different models of IBM Mainframe disks have different track capacities, number of cylinders and device capacities.
Disk Volume Model Bytes/Track Tracks/Cylinder Total Cylinders Total Bytes
d 3390-1
3390-2
56664 56664
15 15
1113 2226
0.946 Gb 1.892 Gb
140
contd..
The smallest unit of space on mainframe disks is one whole track. The OS cannot split tracks for use by other datasets
One or more contiguous tracks or cylinders allocated to a dataset are called an EXTENT
141
contd..
You can specify space request by Block size instead of Tracks or Cylinders.
EXAMPLE: SPACE=(3840,200) You get 200 blocks each holding 3840 bytes = 768,000 bytes on the disk If you code a secondary allocation: SPACE=(3840,(200,60)) plus (60 X 3840 bytes X 15 Extents) as secondary allocation
Since one track is the minimum unit of space, if block size requested works out smaller than one track, you still get one track of disk space.
142
//
// d // With AVGREC=U:
SPACE=(133,10000)
RECFM=FB, LRECL=133
You get (10000 records X 133 bytes) of space The 133 in Space parameter is the average Record length in bytes =U means that the 10000 is a unit estimate of the quantity of records to be written.
143
DD
DSN=DSRC012.DS,
DISP=(NEW,CATLG,DELETE), UNIT=SYSDA, AVGREC=U,
//
SPACE=(133,10)
You get (10 records X 133 bytes) of space. For Secondary allocation request: SPACE=(133,(10,2)) AVGREC can support record quantities by thousands (AVGREC=K) and by millions (AVGREC=M)
d
// // AVGREC=M, SPACE=(133,10)
144
contd..
While creating a PDS, the SPACE parameter is to include a request for Directory Blocks
Space=(TRK,(1,2,7)) You get 1 + (2 X 15) = 31
d
Space=(TRK,(1,,7))
145
contd..
Space=(TRK,(5,,1))
Space=(3840,(200,60))
146
contd..
You receive the secondary space requested for your dataset only as the dataset expands; as you use it
You can get up to 16 extents of secondary space per dataset per disk volume for a PS If you use more than one disk volume for a PS dataset, it can spread up to 16 secondary extents on each volume
d
The limit of 16 extents per dataset per disk volume does not apply to VSAM datasets, which can exist with up to 123 extents
147
contd..
Causes all of the whole unused tracks to be freed for use by other datasets Syntax:
SPACE=(6200,300,RLSE) SPACE=(6200,(300,60),RLSE) SPACE=(80,1,RLSE) d Releases unused tracks. Releases unused tracks in the last active secondary. No space is released since space is less than a track for any disk volume model.
148
contd..
Does not work if the dataset is not closed normally Does not work when the dataset is shared
149
Whether the records are of fixed length or variable length or Undefined length
F V U LRECL n * LRECL
150
contd..
151
contd..
FB VB U A
Fixed length records and records are blocked Variable length and records are blocked Undefined length Used to control printers.
EXAMPLE:
DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
Blocks 100 records; each record 80 bytes in length.
152
contd..
153
contd..
BLKSIZE The size of a block of records; otherwise called the Physical record.
154
contd..
Example: DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
word (BDW) which is pre-pended to the block of records. The first two bytes of the BDW indicates the length of the block.
Example: DCB=(RECFM=VB,LRECL=84,BLKSIZE=8404)
155
contd..
For Undefined format (RECFM=U) records, let the OS determine the block size.
DCB=(RECFM=U,LRECL=0)
156
The DD statement
contd
For SMS managed datasets, the Space and DCB can be set to an installation-defined DATACLASS based on the attributes required for the dataset.
157
158
159
CONCATENATING DATASETS
Is used when you want to process two or more datasets in sequence as if they were a single dataset.
Say, three sequential datasets are monthly reports Jan.DS, Feb.DS, Mar.DS. To get a quarterly report you can concatenate them.
//IN // // DD DD DD DSN=Jan.DS,DISP=SHR DSN=Feb.DS,DISP=SHR DSN=Mar.DS,DISP=SHR
Say, you want the OS to search several load module d libraries for a member:
//STEP010 //STEPLIB // // EXEC DD DD DD PGM=LM of a program DSN=DSRC012.LOADLIB1,DISP=SHR DSN= DSRC012.LOADLIB2,DISP=SHR DSN= DSRC012.LOADLIB3,DISP=SHR
160
LRECL need not be same for variable-length records as long as you place the dataset with the longest LRECL on the first DD d statement.
BLKSIZE need not be same
You can concatenate as many as 114 PDS as PDSs. No concatenation limit on the PDS members or on PS.
Datasets can reside on different devices.
161
HOW TO CONCATENATE?
Concatenate datasets by coding a DD statement for each dataset
//IN // // DD DD DD DSN=Jan.DS,DISP=SHR DSN=Feb.DS,DISP=SHR DSN=Mar.DS,DISP=SHR
DDname should be coded for the first DD statement only d If DUMMY dataset is coded, the rest of the datasets down are not processed
//DD1 // // DD DD DD DSN=A1.PDS,DISP=SHR DUMMY DSN=C1.PDS,DISP=SHR
162
REFERBACKS - *
Backward reference (referback) is used to copy information from a previous DD statement (within the same job) thus simplifying JCL code.
Referback can also be applied to PGM parameter on the EXEC statement On the DD statement, this can be applied to three parameters:
Syntax:
Parameter=*.StepName.DDname
PGM=*.LKED.SYSLMOD
DSN=*.Step010.DD1 Note : If the DDname points to a DD statement in the same job step, you can omit the StepName.
163
EXAMPLE
Referback on a DD statement
//DSRC012A //STEP010 //DD1 JOB EXEC DD NOTIFY=DSRC012 PGM=PGM1 DSN=EMP.PDS,DISP=(NEW,CATLG),
//
// //DD2 //STEP2 //DD2 DD EXEC DD
DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
DSN=INP.PDS,DCB=*.DD1, .. PGM=PGM2 DSN=STU.PDS,DCB=*.STEP010.DD1, ..
//..
164
SPECIAL DD STATEMENTS
JOBLIB STEPLIB SYSPRINT SYSIN SYSABEND SYSMDUMP SYSUDUMP
165
JOBLIB
Used to identify a program library (PDS) to search first when attempting to locate load modules (PGM=) executed within the entire JOB Must be placed after the JOB statement and before the first EXEC statement in the JOB More than one program library can be concatenated
d
If a STEPLIB is specified in a JOB that also has a JOBLIB, the STEPLIB takes precedence when searching for a program
166
EXAMPLE
If two load modules are members of the same PDS then execute the load modules by
//DSRC012A
//JOBLIB //STEP1 //. //STEP2 //.
JOB
DD EXEC EXEC
NOTIFY=DSRC012
DSN=<PDS name>,DISP=SHR PGM=<LM member name> PGM=<LM member name>
The OS searches the JOBLIB DSN for the two load modules.
167
STEPLIB
The STEPLIB DD statement is used to identify a program library to search first when attempting to locate load modules (PGM=) executed during the JOB STEP
More than one program library can be concatenated If a STEPLIB DD is specified in a JOB that also has a JOBLIB, the STEPLIB takes precedence when searching for a program
d
JOBLIB / STEPLIB is used to specify private program libraries
168
EXAMPLE
If two load modules are stored as members of two different PDSs, then execute the load modules by
//DSRC012A //STEP1 //STEPLIB //. JOB EXEC DD NOTIFY=DSRC012 PGM=<LM member name> DSN=PDS1, .. (where the above LM is stored) //STEP2 //STEPLIB EXEC DD PGM=<LM member name > DSN=PDS2, . (where the above LM is stored)
//.
The OS searches the respective STEPLIB DSNs for the two load modules.
169
SYSPRINT
Specifies that an execution report of the load module (PGM) is required. It defines the output file containing the execution messages.
EXAMPLE:
//STEP1
//SYSPRINT // Note:
EXEC
DD
PGM=IEBGENER
SYSOUT=*
//SYSUT1
The SYSOUT parameter specifies the output stream dataset. It routes the report to the class (device) mentioned. SYSOUT=CLASS-code, is the syntax. The class can be any alphanumeric character or an asterisk(*), which refers to the device coded in the MSGCLASS parameter of JOB statement.
170
SYSIN
Used to begin an Input stream dataset; supplies data to the load module
Instream datasets begin with the parameters * or DATA in the SYSIN DD statement Format: //SYSIN
EXAMPLE:
DD
EXEC DD DD
* or DATA, or DSN
PGM=LOAD1 DSN=EMP.PDS,DISP=MOD *
d//STEP2
//STEPLIB //SYSIN /*
HELLO WORLD
171
SYSABEND,SYSUDUMP,SYSMDUMP
These are Abnormal termination dumps used to find the source of an error when a program abnormally terminates Coded after the EXEC statement
172
SYSUDUMP
Used to request a formatted dump of the program area, including the contents of the register, a traceback of subroutines called and information about all the datasets used
The dump can be allocated to the SYSOUT CLASS, DASD or TAPE.
SYNTAX:
d//STEP010
EXEC
//SYSUDUMP DD
173
SYSABEND
Used to request a dump similar to that of SYSUDUMP and additionally the system nucleus.
174
SYSMDUMP
Similar to the request of SYSABEND but the dump is
unformatted.
175
176
Say, a compiler program (IGYCRCTL) used for compiling Cobol source codes.
A linkage-editor program (HEWL) used for link-editing the above compiled object codes.
Sequencing datasets
Deleting datasets and so on
177
contd
Both the utilities functions can be and are easier done using TSO or ISPF d
178
contd
The JCL statements for invoking the utility programs take the form:
//SYSPRINT
//DDname
DD
DSN=.
You can code more than one DD statement depending on the operation; say to copy from one DSN to another. //SYSIN /* DD * REPRO INFILE(DDname1) OUTFILE(DDname2) Command statements
179
contd
RENAME
To rename a dataset
To list the system catalog information on datasets
d LISTCAT
180
contd
This prints the utility programs messages //SYSUT1 Based on the operation, specifies the input dataset
//SYSUT2
//SYSIN
DD
DD
..
*
/*
181
contd
The Control statements vary based on the utility program and the operation (to allocate or copy or delete datasets)
IEBGENER Copies sequential datasets. Use IDCAMS REPRO statement instead. Note that members of PDS are sequential datasets too. Copies PDSs (use IDCAMS REPRO) and Compresses a PDS Compares datasets. Instead use the SUPERC utility of ISPF which can be run on-line or in batch. Lists DASD information. USE IDCAMS LISTCAT statement instead.
IEBCOPY
IEBCOMPR
IEHLIST
182
contd
IEBUPDTE IEFBR14
Renames, deletes, catalog and uncatalog datasets, creates special datasets called Generation data groups (GDG). Use IDCAMS ALTER, DEFINE, DELETE statements instead. Maintains PROCS and Source libraries. Allocates datasets. USE IDCAMS DEFINE statement instead.
183
IEFBR14 program
Commonly called a NULL program
Uses:
To allocate (empty) datasets PS, PDS As a house-keeping measure to check the existence of a dataset (using DISP parameter )
184
contd..
To create a new and empty PS which is to store fixed length records each of 80 bytes.
//DSRC012A //STEP010 //SYSPRINT //DDNEW // // // d // // JOB EXEC DD DD NOTIFY=DSRC012 PGM=IEFBR14 SYSOUT=* DSN=DSRC012.NEW.DS, DISP=(NEW,CATLG,DELETE), SPACE=(TRK,(1,1)), DCB=(LRECL=80, RECFM=FB, BLKSIZE=8000)
Conventionally, new datasets are allocated using ISPF or TSO instead of the above program.
185
contd..
186
contd..
To create a new dataset with variable length records, the longest record being 80 data-bytes.
187
EXEC DD DD
188
IEBGENER
Uses:
To concatenate datasets
189
IEBGENER To copy
To copy sequential datasets
contd..
For backing-up purposes For expanding space allocation EXEC DD DD DD DD PGM=IEBGENER SYSOUT=* DSN=<Input dataset to be Read from> DSN=<Output dataset to be Written into> DUMMY
d//
The input dataset can be a PS or a member of PDS The output dataset can also be a PS or a PDS member
190
IEBGENER To copy
contd..
JOB
EXEC DD DD
NOTIFY=DSRC012
PGM=IEBGENER SYSOUT=* DSN=<Input dataset>
//SYSUT2
DD
DD
DSN=<Output PDS>
*
//SYSIN
Member name=(mem1,mem2,mem3)
(mem1,mem2,mem3 will have the contents of sysut1) /*
191
IEBGENER
contd..
Say, to output only the Empnum and Salary data-bytes, in the order of Salary and Empnum:
//STEP010 //SYSPRINT EXEC DD DD DD DD PGM=IEBGENER SYSOUT=* DSN=<Input dataset> DSN=<Output dataset> *
Generate Maxflds=2
Record field=(5,1,CH,6) field=(5,46,CH,1) (Length,Location in input,Format,Location in the output)
192
IEBGENER -
contd..
asteriks between Salary and Empnum fields (similar to X in the Sort utility), code Maxlits:
//STEP010
//SYSPRINT //SYSUT1 //SYSUT2 //SYSIN
EXEC
DD DD DD DD
PGM=IEBGENER
SYSOUT=* DSN=<Input dataset> DSN=<Output dataset> *
Generate Maxflds=2,Maxlits=2 Record field=(5,1,CH,8) field=(5,46,CH,1) (Length,Location in input,Format,Location in the output) field=(2,**,,6)
193
IEBGENER -
contd..
If output is to be routed to the three PDS members, but to perform reformatting only in the second member
//SYSIN
DD
Generate Maxname=3,Maxflds=2 Member name=mem2 Record field=(5,1,ch,8) field=(5,46,ch,1) field=(2,**,,6) Member name=(mem1,mem3)
194
contd
To select rows of records based on some criteria, say, employees getting a salary of 1000, code Maxgps and Record Ident (similar to Include / Omit Cond of Sort utility)
//STEP010
//SYSPRINT //SYSUT1 //SYSUT2
EXEC
DD DD DD
PGM=IEBGENER
SYSOUT=* DSN=<Input dataset> DSN=<Output PDS>
//SYSIN
DD
195
contd..
Altering the BLKSIZE sub-parameter of the DCB in the output Altering the LRECL too
Code GENERATE control statement
d//SYSUT1
//SYSPRINT //SYSUT2
//SYSIN
DD
196
contd..
//STEP010
//SYSPRINT //SYSUT1 //
EXEC
DD DD DD DD DD
PGM=IEBGENER
SYSOUT=* DSN=<First unsorted dataset> DSN=<Second unsorted dataset> Concatenation DSN=<The concatenated dataset> DUMMY
d//SYSUT2
//SYSIN //
197
contd..
<Instream data>
/*
d//SYSUT2
//SYSIN //
DD DD
198
//
// //SYSIN /*
COPY INDD=SYSUT1,OUTDD=SYSUT2
You can merge many input PDSs too. DDnames are necessary for merge.
199
IEBCOPY
contd..
You can further rename the new PDS to that of the deleted PDS. Use IDCAMS ALTER command.
//STEP010 //SYSPRINT //SYSIN EXEC DD DD PGM=IDCAMS SYSOUT=* * name)
200
IEBCOPY
contd..
You can alter the BLKSIZE but not the LRECL using IEBCOPY
201
IEBCOPY
contd..
To request an UNLOAD operation, specify a partitioned input data set and a sequential output data set
Use to create a back-up copy on tape.
To request a LOAD operation, specify a sequential input data set and a partitioned output data set
Used to restore a PDS from tape to DASD.
202
contd
// //SYSIN
COPY INDD=SYSUT1,OUTDD=SYSUT2
SELECT MEMBER=(member1,member2..)
/*
203
IEBCOPY
You can assign a new name to the copied member
contd
204
contd..
//INOUT
//SYSIN /*
DD
DD
COPY INDD=INOUT,OUTDD=INOUT
Since input and output datasets are the same, must code COPY control statement.
205
IEBCOMPR
Uses
To locate data-differences between two datasets. Comparison occurs at the record-level. Normally used to ensure accuracy of back-ups taken.
Can compare two sequential or partitioned datasets.
//STEP010 EXEC PGM=IEBCOMPR //SYSPRINT DD SYSOUT=* //SYSUT1 DD DSN=<Dataset1>,DISP=Old //SYSUT2 DD DSN=<Dataset2>,DISP=Old //SYSIN DD * COMPARE TYPORG=PO /* RC of 0 implies no data-differences. RC of 8 implies differences.
206
+9 and then -9
(+ comes before -)
Numeric data sequenced based on the numeric value, taking sign too into consideration. In ascending order:
-9 and then +9 (-9 is less than +9)
207
contd
208
contd.
Character data and Numeric data are sorted differently. The following fields are listed in ascending sequence for both character and numeric data.
As character data +9, -9 b9, -9 (+ comes before -) (Blank comes before -)
b999, 0009
d
As Numeric data -9, +9 -9, 9 9, 999 (-9 is less than +9) (-9 is less than 9) (9 is less than 999)
209
contd.
Sort order of alphanumeric data (character data) is called its Collating sequence, which specifies the sort order of each character in the character set
Two main collating sequences are EBCDIC and ASCII; the mainframe OS uses EBCDIC
EBCDIC blank .<(+I=&!.= a through z ASCII blank !#.()+,-./ 0 through 9 :;< = >?@ A through Z [\] a through z {I}-
A through Z 0 through 9
210
contd.
Empno
Empname
Salary
211
contd..
212
contd..
//STEP010 //SYSPRINT
//SYSOUT
//SORTIN //SORTOUT
DD
DD DD DD
SYSOUT=*
DSN=<the unsorted dataset> DSN=<The destination dataset name for sorted data> *
d//SYSIN
SORT FIELDS=(1,5,CH,A) The control statement supplies a Sort-Key implying: /* Start sorting the record at the absolute byte address (1), Length, the number of bytes to be included in sorting (5) , Format of sorting (EBCDIC character),
213
contd..
11111sujit
22222ajay
33333mala 55555danny
admin
projects marketing
07000
20000 15000
214
contd..
Length,
Length of data to be sorted.
Format,
Order)
Ascending, Descending
record. Databytes 1 to d 4092 only can be the start bytes CH AC FS EBCDIC character ASCII character Signed numeric character
in the sort-key.
D1
The keys are listed from left to right in the major to minor order.
215
contd..
You can select data-bytes (columns) to be output and sort on those columns Since the start data-byte in the sort-key can be only within the first 4092 data bytes, to consider data beyond 4092 bytes as the start data-byte, you can reformat.
To reformat, code:
216
contd..
Before sorting, to include only employee number and salary field and to sort in descending order of salary field:
DD * 5555515000
//SYSIN
/*
2222207000
3333320000
d
The sorted dataset will contain:
3333320000
5555515000 1111110000 2222207000
217
contd..
If data beyond 4092 bytes, say, at the 5000th byte is to be considered as the start position in the sort-key and sequencing to be done in ascending order of that field, then :
DD *
//SYSIN
218
contd..
To reformat data-bytes after sorting, OUTREC FIELDS is used. Also used to space out fields in the output.
To obtain only the Empno and Salary fields in the output, but to sort on Empname field in ascending order:
d //SYSIN
DD * SORT FIELDS=(6,25,CH,A) ------------------------- 22222ajay. OUTREC FIELDS=(1,5,46,5) 55555danny.. 33333mala The output dataset will contain: 2222207000 11111sujith 5555515000 3333320000
1111110000
219
contd..
To include character-literals, say, spaces between the Empno and Salary fields in the output dataset:
Code OUTREC FIELDS=(1,5,2X,46,5) Two spaces
The output dataset will contain: 22222 07000 55555 15000 33333 20000
11111 10000
220
contd..
To select records (rows) based on some criteria, INCLUDE COND or OMIT COND is used Takes the form,
Include / Omit Cond=(Start-byte,Length,Format,Comparison,Constant)
221
contd..
To select employees getting a salary of 1000 and sort in ascending order of employee number
//SYSIN DD * INCLUDE COND=(46,5,CH,EQ,C1000) SORT FIELDS=(1,3,CH,A) /*
Conversely, Omit Cond can be used to exclude employees with salary of 1000.
Can use connect operators AND and OR to form several logical conditions
222
contd..
JOB EXEC DD DD DD DD DD
NOTIFY=DSRC012 PGM=SORT SYSOUT=* SYSOUT=* DSN=<First Unsorted Dataset> DSN=<Second Unsorted Dataset> Concatenation DSN=<SORTED DATASET>
d//
//SORTOUT
//SYSIN
/*
DD
SORT FIELDS=(1,5,CH,A)
223
contd..
MERGE FIELDS=(1,5,CH,A)
224
But can concatenate two varying length datasets as long as the highest LRECL is coded first.
The concatenated output will take on the highest LRECL
225
Chapter 8 - PROCEDURE
226
//SYSLIN DD DSN=OBJECT module EXEC PGM=IEWL d //Lked //SYSLIN DD DSN=OBJECT Module //other DD statements. //SYSLMOD DD DSN=LOAD Module
227
contd
//SYSIN
/*
DD
d SORT FIELDS=(1,5,CH,A)
228
229
First code an Instream Procedure Then convert the Instream Procedure to a Cataloged Procedure
230
//STEP010
//SYSPRINT //SYSOUT //SORTIN //SORTOUT //SYSIN
EXEC
DD DD DD DD DD
PGM=SORT
SYSOUT=* SYSOUT=* DSN=<Unsorted Dataset Name> DSN=<Sorted Dataset Name> *
SORT FIELDS=(1,5,CH,A)
d/*
//
231
SORT FIELDS=(1,5,CH,A)
Separate the null statement(//) from the JCL with a PEND statement.
232
//SORTPROC
//PSTEP010 //SYSPRINT //SYSOUT
PROC
EXEC DD DD
//SORTIN
DD
DD DD PEND
d//SORTOUT
//SYSIN //
//
233
JOB
PROC EXEC DD
NOTIFY=DSRC012
PGM=SORT SYSOUT=&To
//SYSOUT
DD
DD DD DD PEND
SYSOUT=&To
DSN=&Unsorted Dataset DSN=&Sorted Dataset DSN=&PDS(Mem1), DISP=SHR
234
//SORTPROC
//PSTEP010 //SYSPRINT //SYSOUT
PROC
EXEC DD DD
To= *
PGM=SORT SYSOUT=&To SYSOUT=&To
//SORTIN
DD
DD DD PEND
DSN=&Unsorted Dataset
DSN=&Sorted Dataset DSN=&PDS(Member), DISP=SHR
//SORTOUT //SYSIN // //
235
//SORTPROC PROC
To= *
PGM=SORT SYSOUT=&To SYSOUT=&To DSN=&Unsorted Dataset DSN=&Sorted Dataset DSN=&PDS(Member), DISP=SHR
//SYSIN // //STEP010
//
// //
Unsorted dataset=Name,
Sorted dataset=Name, PDS(Member)=Name
This is called an INSTREAM PROCEDURE. You can code 15 instream procs in 1 job.
236
237
Code JCLLIB ORDER statement for Cataloged procedures stored in user private libraries.
//DSRC012A
// //STEP010 //
JOB
EXEC
NOTIFY=DSRC012
PROC=SORTPROC, Unsorted dataset=Name,
//
Sorted dataset=Name,
PDS(Member)=Name
// //
238
Using a Procedure
Users invoke a Proc by coding EXEC Proc-Name or PROC=Proc-Name Based on the userss specific processing needs, a PROC can be used by:
Assigning actual values to the symbolic parameters in the proceure Overriding the existing parameters of the EXEC and DD statements in the procedure Nullifying the existing parameters of the EXEC and DD statements in the procedure Adding new DD statements to the procedure
//SORTIN
//SORTOUT //SYSIN
DD
DD DD
DSN=&UNSORTED DATASET
DSN=&SORTED DATASET DSN=&PDS(Member), DISP=SHR
239
//SYSIN
DD
DSN=&PDS(Member), DISP=SHR
//DSRC012A
JOB EXEC
// //STEP010 // // //
240
//SYSOUT
//SORTIN //SORTOUT //SYSIN //DSRC012A
DD
DD DD DD
SYSOUT=&To
DSN=&UNSORTED DATASET DSN=&SORTED DATASET DSN=&PDS(Member), DISP=SHR JOB EXEC NOTIFY=DSRC012 PROC=SORTPROC, Unsorted dataset=Name, Sorted dataset=Name, Time.PSTEP010=(,5) DD *
d //
// //
//STEP010
//PSTEP010.SYSIN /*
SORT FIELDS=(1,5,CH,A)
//
241
//DSRC012A // //STEP010
JOB
NOTIFY=DSRC012
//
// //PSTEP010.SYSOUT //
Unsorted dataset=Name,
Sorted dataset=Name,Time.PSTEP010= DD SYSOUT=
242
To= *
PGM=SORT SYSOUT=&To SYSOUT=&To
//SORTIN
//SORTOUT //SYSIN
DD
DD DD
DSN=&UNSORTED DATASET
DSN=&SORTED DATASET DSN=&PDS(Member), DISP=SHR
//DSRC012A
JOB
EXEC
NOTIFY=DSRC012
PROC=SORTPROC, Unsorted dataset=Name, Sorted dataset=Name
// //STEP010 // //
//PSTEP010.SYSIN
/* //
DD
SORT FIELDS=(1,5,CH,A)
243
//SYSOUT
//SORTIN //SORTOUT //SYSIN
DD
DD DD DD
SYSOUT=&To
DSN=&UNSORTED DATASET DSN=&SORTED DATASET DSN=&PDS(Member) No DISP parameter
//DSRC012A
JOB
EXEC
NOTIFY=DSRC012
PROC=SORTPROC, Unsorted dataset=Name, Sorted dataset=Name,
// //STEP010 // //
//
// //PSTEP010.SYSIN // DD
PDS(Member)=Name
Time.PSTEP010=(,5) DISP=SHR
244
Notes on Procedures
A Job can contain 15 instream procedures.
An Instream procedure can call a Cataloged procedure. A Cataloged procedure cannot call an Instream procedure. A Cataloged procedure can call a Cataloged procedure.
If each procedure resides in 15 different PDS, then the JCLLIB ORDER must identify those PDS to the OS.
In the invoking JCL of PROCs, overriding statements must come before add-on statements
245
Notes on Procedures
To override a parameter on all the steps in a PROC with the same value, call the PROC and code the parameter=its value.
You can add-on and override DD parameters only one level down from the invoking step
If the called PROC is not found in the private libraries of the JCLLIB order statement, then the OS searches the system library even though not coded in the JCLLIB statement
To override only certain concatenated datasets in a PROC, in the calling JCL, code just DSN for those datasets which need not be overidden d
246
247
Processing Payroll
Invoicing regular customers Income Tax report Backup
Statistics
Audit Trails
In each processing cycle, a new generation (updated version) of the dataset is generated.
248
Referring a GDG
All generations have the same dataset name.
d Upto 255 relative generations can exist and must be cataloged. Generations of a GDG are sequential and can reside on disk or tape.
249
Advantages of GDG
No need to change the JCL between runs
//DD1
// // //
DD
DSN=DSRC012.Tax.State(+1),
DISP=(NEW,CATLG), SPACE=(TRK,(1,5), DCB=DSRCO12.MODL.MODL
250
251
For non-SMS managed datasets, the second step involves creating a model dataset for supplying the DCB parameters to the new individual dataset belonging to a group. This model dataset must be cataloged. For SMS managed datasets, this step can be bypassed.
d DSN=DSRC012.BASE.GDG(+1)
252
DEFINE GDG(NAME(DSRC012.BASE.GDG)-
d SCRATCH)
/* //
253
contd
d
EMPTY / NOEMPTY : Specifies what action OS should take when
the LIMIT value is reached. EMPTY means that all generations should be removed (uncataloged) from the group; NOEMPTY means that just the oldest generation should be removed (uncataloged).
254
contd
OWNER : Specifies 1 to 6 character owner-id for the GDG. TO & FOR : Specifies the expiration date TO(yyyyddd) or a retention
255
256
contd
The system can use the DCB values given in the model as default values when a new GDS is created
The DCB values can also be overidden while creating the new
GDS.
257
//
DCB=DSRCO12.MODL
258
contd..
DSN should be coded for new generations, along with the generation number in parentheses.
Disposition should be CATLG for all new generations Generations are referred by the same generation number throughout the various steps in the job
The system updates the generation number only when the job terminates.
259
contd..
After the job terminates a new generation is added to the GDG and becomes the current generation
The former current generation becomes a previous generation Relative generation number is used to uniquely identify every data set in the GDG
The current generation is identified as DSN=GDGname(0). The earlier generation is identified as DSN=GDGname(-1) and the second oldest generation is identified as DSN=GDGname(-2) and so on.
260
DSRC062.BASE.GDG
DSRC062.BASE.GDG.G0001V00
DSRC062.BASE.GDG.G0002V00 DSRC062.BASE.GDG.G0003V00
(-2)
(-1) (0)
261
262
263
GDG Notes
If:
//Step010 EXEC PGM=IEFBR14 //DDGDSA DD DSN=GDG.Index(+1),DISP=(New,Catlg). //
//DDGDSB DD DSN=GDG.Index(+2),DISP=(NEW,Catlg).
// After the job terminates normally, (+2) becomes the current relative generation 0, and (+1) becomes the relative generation (-1). But see this: //Step010 EXEC PGM=IEFBR14 //DDGDSA DD DSN=GDG.Index(+2),DISP=(New,Catlg). // This creates an absolute generation rolling forward by +2 ; but the relative generation rolls back by 1 only (ie) +2 becomes 0, the current relative generation.
264
Q&A
If TIME=1, CLASS=A is coded on a JOB statement where class A is
defined for jobs not exceeding 30 secs, will the job run successfully if it requires 45 secs to process? The datasets given in Joblib / Steplib statements cannot be referred back. State - True/False What are the valid DSORG values ? What is the purpose of DD * statement?
a) Begins an input data prompt at the system console b) Begins an in-stream dataset c) Marks the end of a command stream d) Includes all datasets within a naming pattern If your program abends and you need to print the dump generated by the system we can use ----265
Q&A
What will happen if region=0k is coded on job statement?
--------- selectively executes job steps. //AS1 DD DSN=AAA.BBB,UNIT=AFF=AS0; What device does this dataset use? a) Device AS0 b) Device in address AS0 c) Device mentioned in AS0 statement d) Error in coding device
d
What will be the system response for the jcl? //JW1 JOB NOTIFY=DSRC050 What u mean by include statement in JCL? What are the jcl statements that should not be used in INCLUDE groups?
266
Q&A
//ddname DD DATA and //ddname DD * are equivalent
a) Always 0% b) When using default delimiters only 100%
267