jcl.ppt
DESCRIPTION
Sample JCL PPTTRANSCRIPT
d
D
S
R
C2
CHAPTERS1) 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
9) Generation data groups
d
D
S
R
C4
Typical Workloads to the Mainframe OS
What is a Workload? Any work to be performed by the OS is called workload.
How is the work performed? The OS performs the work by executing the program’s
instructions.
d
D
S
R
C5
Typical Workloads to the Mainframe OS contd..
What are the typical workloads to the Mainframe OS?
Batch work Interactive work
BCPJESV
TA
M
Eg. Payroll report
Eg. ATMs
User
OS
Printer
User
OS
Storage device
d
D
S
R
C6
Batch Work (also called Batch Processing) Work performed without end user interaction.
Runs in the system background, freeing the user to do other work.
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.
d
D
S
R
C7
BCP / JES / VTAM
BCP constitutes the core OS.
JES provides the interface between the BCP and the batch processes.
VTAM provides the interface between the BCP and interactive users.
BCPJES
VT
AM
Batch work Interactive users
d
D
S
R
C8
What is a JOB ? The Batch process is called JOB.
To render the Job to the OS we use Job Control Language (JCL). JCL is the way to tell the OS:
which programs are to be executed which datasets are needed by the executing programs.
JCL also describes to the OS: The Job’s name When the job is to be performed by the OS The requestor of the job, among other things
d
D
S
R
C9
The various JOBS
BCP
JES
Job1
(Execution of your Application programs; say Cobol , PL/I programs)
Job3
(Execution of Sub-system programs – to start TSO, CICS environments
Job2
(Execution of another user’s Application programs
d
D
S
R
C10
The JCL Statements
A Job is coded using JCL. JCL statements look like:
//……. JOB …….
//……. EXEC …….
//……. DD .……
Through these statements you supply information and instructions to OS:
JOB - carries the Job name, the type of job //DSRC062 JOB CLASS= type of job
EXEC - carries the program name
//STEP1 EXEC PGM=Load module’s name
DD - carries the datasets used by the program.
//DD1 DD DSN=Dataset name
d
D
S
R
C11
The JCL Statements contd…
One JOB can execute more than one program.
//……. JOB …….
//……. EXEC PGM=…….
//……. DD
//……. EXEC PGM=…….
//……. DD ………….
d
D
S
R
C12
Looking back at the Jobs
JES
BCP
Your Job:
//Job1 JOB ….
//…. EXEC Pgm=LM of Cobol program
//… DD …
//… Exec Pgm=LM of PL/I program
//… DD …
Job2
(Execution of Application programs, by another user)
Job3
(Execution of sub-system program – to start TSO, CICS environments
d
D
S
R
C13
A Job’s life cycleThe Job Enters the systemThe Job is placed in the Input Job queueThe Job gets Executed by the OSThe Job completes execution and moves to the Output
queue, on to other devices.
Inputqueue
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Redirect to other devicesJOB
(JCL coded
using TSO)
Execution
d
D
S
R
C14
Jobs entering the system through TSO The commonest way of Jobs entering JES is vide a Terminal software
called TSO, Time sharing option
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.
Inputqueue
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Redirect to other devices TSO//Job1 JOB …..//….. EXEC PGM=..
Submit
d
D
S
R
C15
Jobs in the Input queue
After the Jobs are submitted: JES gives each job a JOB ID which you can view and Queues the jobs in the Input queue based on the job’s
CLASS coded in the JCL.
Class E I
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Redirect to other devices TSO//Job1 JOB Class=I//….. EXEC PGM=..
Input queue
SubmitJob ID
d
D
S
R
C16
Jobs in the Input queue – CLASS codes 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
d
D
S
R
C17
Jobs in the Input queue – further processing contd..
After jobs get queued, the job’s JCL is:
converted into an internal text
scanned for syntax errors 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.
E I
Output queueJ E S
BCP
Input queue
d
D
S
R
C18
Jobs in the Input queue – Queue Entry
• Each job in the input queue awaiting execution has the
an entry:
Job ID Job Name Job Class Priority
d
D
S
R
C20
Jobs getting Executed – Program Initiators
From the Input queue, jobs are “picked” for execution
by the BCP using special programs called Program
Initiators. Program Initiators picks jobs for execution based on the
jobs’ CLASS.
D E E I I P
Output queue
J E S
BCP
Input queue Initiators
1
2
3 4
d
D
S
R
C21
Jobs getting Executed – Initiators/Classes 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.
D E E I I P
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Redirect to other devices TSO//Job1 JOB …..//….. EXEC PGM=..
Input queue
Submit
Job ID
Initiators Class-List
1 E
2 PI
3 IA 4 F
d
D
S
R
C23
Jobs getting Executed – Job completion contd..
The OS Notifies the user when the job completes.
E E P
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Input queue
Submit
Job IDNOTIFY
(When done)
TSO//Job1 JOB …..//….. EXEC PGM=..
d
D
S
R
C24
Jobs in the Output queue
JES queues the Jobs’ Output in the output queue.
A job’s output comprises: the Report about the job
which Initiator ran the job
the CPU time taken by the job to run, among other
messages
the Program’s output Like the Payroll report
d
D
S
R
C25
Jobs in the Output queueThe job’s outputs are queued based on the Print Classes:
Indicated by MSGCLASS on Job statement for Reports
Indicated by SYSOUT on DD statement for Program’s output
Output queue
View / Purge
J E S
BCP
Printer, Tapes, Disks
Redirect to other devices TSO//Job1 JOB …..//….. EXEC PGM=..
Input queue
Submit Job ID
Print Class
A
B
X or T
Class
A
E
E
Sysout
MsgClass
d
D
S
R
C26
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
d
D
S
R
C27
JES Control Statements These are non-JCL statements that are used to communicate with JES.
They provide for instructions, the same way as JCL statements.
A JCL statement to have the OS send you a Notification when your job completes execution:
//……… JOB Notify=TSO-UserID
d
D
S
R
C28
JES Control Statements contd..
Equivalent JES control statement:
/*Notify TSO-UserID JES2
//*Notify TSO-UserID JES3
//……… JOB
//……… JOB
JES control statements look like:
/* or //*JES Command ……..
Based on the command, the JES control statements are
coded before or after the JOB statement.
d
D
S
R
C30
Coding JCL statements using TSO
You code JCL using TSO, Time sharing option. A component of TSO called ISPF (Interactive System Productivity Facility) provides a full
screen editor to create source program statements and JCL.
You use TSO to submit your jobs to the OS for processing.
You also use TSO to see the results after processing, using SDSF (Spool Display and Search Facility), a software product you can access from TSO.
d
D
S
R
C31
Coding JCL statements - Syntax Syntax - A JCL statement has 5 fields:
ID Name Operation Operands Comments
//DSRC012A JOB NOTIFY=DSRC012 The Job…
//STEP010 EXEC PGM=LM of program The Step…
//DD1 DD DSN=Dataset name,Space=………….,DISP=SHR,x
//
1 727112 803 10
d
D
S
R
C32
Coding JCL statements - SyntaxSyntax - A JCL statement has 5 fields:
ID Name Operation Operands Comments
//DSRC012A JOB NOTIFY=DSRC012 The Job…
//STEP010 EXEC PGM=LM of program The Step…
//DD1 DD DSN=Datasetname,Space=………….,DISP=SHR,x
//
7271123 10 801
d
D
S
R
C33
Coding JCL statements – Identifier field contd..
//DSRC012A JOB NOTIFY=DSRC062 The Job..
//* The Step…
//STEP010 EXEC PGM=LM of program
//SYSIN DD * The DD..
……Instream data……
/*
//
The Identifier field must be coded in columns 1, 2, 3 Identifies:
a JCL statement if // in columns 1 and 2 Comment statement / JES3 statement if //* in columns 1, 2, 3 Delimiter statement / JES2 statement if /* in columns 1 and 2
1 2 3
d
D
S
R
C34
Coding JCL statements – Name field contd..
//DSRC012A JOB NOTIFY=DSRC012 The Job
//STEP010 EXEC PGM=LM of program The Step
//DD1 DD DSN=Dataset name, The DD
// DISP=SHR
Name field must be coded in columns 3 through 10 Names a JCL statement. 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.
3 10
d
D
S
R
C35
Coding JCL statements – Operation field contd..
//DSRC012A JOB NOTIFY=DSRC012 The Job
//STEP010 EXEC PGM=LM of program The Step
//DD1 DD DSN=Dataset name, The DD
// DISP=SHR
Operation field must be coded from or after column 12 onwards It indicates the type of control statement (JOB, EXEC or DD).
Must be preceded and followed by at least one blank.
12
d
D
S
R
C36
Coding JCL statements – Operand field contd..
//DSRC012A JOB NOTIFY=DSRC012 The Job
//STEP010 EXEC PGM=LM of program The Step
//DD1 DD DSN=Dataset name,DISP=SHR
//
The Operand (Parameter) field follows the operation field Contains one or more parameters separated by commas
No blanks between the parameters Parameters can be coded up to column 71
71
d
D
S
R
C37
Coding JCL statements – Comment field contd..
//DSRC012A JOB NOTIFY=DSRC012 The Job..
//STEP010 EXEC PGM=LM of program The Step..
//* The DD….
//DD1 DD DSN=Dataset name,DISP=SHR
The Comment field can be coded after the operand field, up to column 71 It contains documentation on the JCL statement Must not be used unless there is an operand field and must
follow the operand field Must be preceded by at least one blankNote : The Comment field is different from Comment statement (//*);
though they both serve to code comments.
71
d
D
S
R
C38
Coding JCL statements - Continuation of Statements Continuation of the Parameter field on to the next line
If you interrupt the field including the comma before column 71
//DD1 DD DSN=Dataset name,Space=(TRKk,(1,1)),
// DISP=SHR,DCB=…….
If you interrupt the field including the comma at column 71
//DD1 DD DSN=Dataset name,Space=………….,DISP=SHR,x
// DCB=……..
71
71 72
16
16
d
D
S
R
C40
The JOB statement
Syntax: //Jobname JOB <Positional Parameters>,<Keyword parameters>
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
Instructs where the job’s reports must be sent
d
D
S
R
C41
The Job statement – a detailed look
//Jobname JOB <Positional Parameters>,<Keyword parameters>
Mandatory.
Usually your TSO userid followed by one character.
Accounting information,
Programmer’s name.
NOTIFY,CLASS,PRTY,
MSGCLASS,MSGLEVEL,
RESTART,TIME, TYPRUN
ADDRSPC, REGION among
others.
Example:
//DSRC012A JOB (012,John),
NOTIFY=DSRC012,CLASS=A,PRTY=15, //
MSGCLASS=T,MSGLEVEL=(1,1)
d
D
S
R
C42
Positional and Keyword parameters//Jobname JOB <Positional Parameters>,<Keyword parameters>
Acct. Info.,Prog.name CLASS=..…,NOTIFY=….
Positional parameters Must precede keyword parameters Within a list of parameters, must be in specific positions separated by commas Absence of first parameter in a list must be indicated by a comma
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
d
D
S
R
C43
The Job statement – ACCOUNTING INFORMATION
Identifies your job for accounting or billing purposes; say to bill for the CPU time used by your job. Format is installation dependent. Optional
Example : //DSRC012A JOB (012)
Additional accounting information can be given (installation dependant):
//DSRC012A JOB (012,1)
d
D
S
R
C44
The Job statement – PROGRAMMER’S NAME
Identifies the user ie. you or, the kind of Job. Format is installation dependent. Specified in apostrophes if the programmer’s name parameter contains spaces or special
characters, other than the period or hyphen. Optional
Example : //DSRC012A JOB (012,1),JOHN
//DSRC012A JOB (012,JOHN,CICS),‘PROD CICS’
d
D
S
R
C45
The Job statement - CLASS
Queues jobs for execution based on the importance of the
job. The importance in turn depends on the type of the job: A job involving complex statistical calculations
Is a type of job taking a lot of CPU time and to be run in the 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
Is a type of job to be run in the evenings
A job running system programs
Is a type of job to be run continuously
d
D
S
R
C46
The Job statement – CLASS contd.. A Job is assigned a CLASS based on its ‘type’
CLASS is represented by a single alphanumeric character
(A-Z,0-9); fixed by the installation.
CLASS=E may imply type which is run in the evenings
CLASS=9 may imply a job that runs at a specific time
of the day
Example : //DSRC012A JOB (012,John), NOTIFY=DSRC012,CLASS=E
CLASS gives jobs a preference for execution by the OS.
JOB CLASS 1 E 2 P 3 O
d
D
S
R
C47
The Job statement – CLASS 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.
d
D
S
R
C48
The Job statement – PRTY
Syntax for Priority.
Determines scheduling the jobs belonging to the same
CLASS.
JOB CLASS PRTY 1 E 1 2 E 13
d
D
S
R
C49
The Job statement – PRTY contd..
PRTY ranges from values 0 to 15 if JES2 is used
15 being the highest priority. 0-14 in JES3 is used
14 being the highest priority.
Example:
//DSRC012A JOB CLASS=E,PRTY=1
//DSRC012B JOB CLASS=E,PRTY=15
d
D
S
R
C50
The Job statement – PRTY 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 CLASS PRTY 1 E 1 2 E 13 3 E 13
d
D
S
R
C51
The Job statement – DPRTY
Syntax for Dispatching Priority
Sets priority for CPU allocation to jobs that are running Your job can get the CPU prior to the other jobs.
d
D
S
R
C52
The Job statement - TIME
Establishes a CPU time limit for a job to execute all its
steps.
Syntax is TIME=(MINUTES,SECONDS)
Minutes range from 1 through 357912 (248.55 days) Seconds range from 1 through 59
TIME=(1,30) implies maximum CPU time for this JOB is
1minute and 30 seconds.
System will abend the job with a system completion
code of 322, if the specified TIME is exceeded.
d
D
S
R
C53
The Job statement – TIME contd..
Reasons to code TIME 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.
d
D
S
R
C54
The Job statement – TIME contd..
Examples:
TIME=2 maximum CPU time for this JOB is 2 minutes
TIME=(,2) maximum CPU time allowed is 2 seconds
//DSRC012A JOB NOTIFY=DSRC012,TIME=(,50)
d
D
S
R
C55
The Job statement - REGION
Specifies the amount of virtual storage a job can use Every step within the job gets that amount of storage as requested vide
the REGION parameter
Can be specified in kilobytes(K) or Megabytes(M) Syntax is REGION=nK n ranges from 1K to 2096128K
nM n ranges from 1M to 2047M
If not coded, a system default or installation defined
The system allocates the storage above and below the 16 MB line
Example:
//DSRC012A JOB REGION=4092K same as coding
//DSRC012A JOB REGION=4M
d
D
S
R
C56
The Job statement – REGION contd…
If the job requires more storage than what it requests,
the system returns a completion code of 804 or 80A.
d
D
S
R
C57
The Job statement - ADDRSPCSyntax for Address space
Prohibits or allows a job (its steps) from being paged
Syntax is ADDRSPC=REAL or VIRT (Virtual) REAL locks the job in central storage during execution VIRT, the default, lets the job be paged
Do not use REAL as it will reduce system performance Use REAL only for time-dependant programs and those that dynamically modify channel programs during I/O operations.
Example: //DSRC012A JOB ADDRSPC=REAL
d
D
S
R
C58
The Job statement - NOTIFY
• Requests that the OS sends a message about:
• the Job’s completion and
• its completion status – whether normal or abnormal
• Code NOTIFY=your TSO userID, if you want the
system to notify you the above messages.
Example :
//DSRC012A JOB (012,John), NOTIFY=DSRC012
d
D
S
R
C59
The Job statement – NOTIFY contd..
The OS giving your job a number (JobID) when submitted.
d
D
S
R
C60
The Job statement-NOTIFY–a screen shot contd..
‘Notification’ about completion and completion status.
d
D
S
R
C61
The Job statement – NOTIFY contd…• Omitting this parameter may result in you seeing the
OS giving your job, a number (JobID) when submitted
but not its completion and completion status.
To notify someone (userid) not at the job’s origin, code the JES2 ‘NOTIFY node ’ control statement
Example:
/*NOTIFY node.TSOuserid
//DSRC012A JOB CLASS=E,<other parameters>
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
d
D
S
R
C62
The Job statement - MSGCLASS Syntax for Message Class After the job run, directs the Reporting messages of the OS to
disk areas or printers Reports usually held in the output queue without printing, for viewing vide
TSO.
The reporting messages (commonly called ‘printed output’) include: The JES2 ‘JOB LOG’ stating
whether the job was run
when the job started and stopped
which initiator picked the job for execution
the JES2 ‘JOB STATISTICS’ comprising
the date of job run
the number of lines of JCL code (cards) read by the OS
the JCL submitted is listed (with the JCL statements numbered by the OS).
d
D
S
R
C63
The Job statement – MSGCLASS contd…
the ‘ALLOCATION’ messages stating 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 communicates whether the step executed successfully or not.
the disposition of the datasets after the step executed
The final messages states the CPU time taken to run the entire job (all steps).
d
D
S
R
C64
The Job statement – MSGCLASS contd..
MSGCLASS is represented by a single alphanumeric character (A-Z,0-9); fixed by the installation.
MSGCLASS=T may hold messages in the output queue for viewing
from TSO and purged by the user after some specific
time frame
MSGCLASS=A may route messages directly to a printer
MSGCLASS=D may hold messages in the output queue for viewing
from TSO and purged automatically by the system
after some time.
If not coded, defaults to installation standards.
Example: //DSRC012A JOB CLASS=E,MSGCLASS=T
d
D
S
R
C65
The Job statement - MSGLEVEL
Syntax for Message Level.
Determines the amount of JCL and Allocation messages to be directed to the device indicated in MSGCLASS
Syntax is MSGLEVEL=(JCL,Allocations) JCL - takes values 0 or 1 or 2
0 print only JOB statement 1 print all user-coded JCL plus procedure JCL
statements 2 print only user-coded JCL statements
d
D
S
R
C66
The Job statement – MSGLEVEL contd..
Allocations - takes values 0 or 1 0 print all the allocation messages only if the job ends
abnormally
1 print all the allocation messages whether the job ends
normally or abnormally
Default MSGLEVEL=(1,1)
Example:
//DSRC012A JOB MSGCLASS=T,MSGLEVEL=(1,0)
d
D
S
R
C67
The Job statement - TYPRUN
Syntax for Type Run.Prevents job run
to give your JCL a syntax check or to hold your job for later execution
To give your JCL a syntax check use TYPRUN=SCAN SCAN causes your JCL to be checked for coding
errors. The coding errors comprise: mis-spelled and misplaced parameters Invalid characters Unbalanced parantheses
Your job does not run; resources are not allocated.
The syntax error messages are routed to the output
queue and can be viewed.
d
D
S
R
C68
The Job statement – TYPRUN contd..
To hold your job for later run, use TYPRUN=HOLD HOLD causes your job to remain in the input queue without going in for execution until explicitly
RELEASEd by the operator for execution; this provided your JCL is syntactically correct.
If incorrect, your job gets routed to the output queue.
To print your JCL to a printer without running the job use TYPRUN=COPY; ensure you assign a printer class to MSGCLASS
Example:
//DSRC012A JOB NOTIFY=DSRC012,TYPRUN=SCAN
To make your job run, do not code TYPRUN
d
D
S
R
C69
The Job statement - RESTART
• Enables continuing running of a previously aborted job
• Specifies a starting Step for the new job run
• Syntax is RESTART=STEPNAME
Example:
//DSRC012A JOB RESTART=STEP2//STEP1 EXEC PGM=LM of one program//………//STEP2 EXEC PGM=LM of another program//………
d
D
S
R
C71
The EXEC Statement
Syntax : //Stepname EXEC <Positional Parameters>,<Keyword parameters>
Purpose Names the EXEC statement Mainly identifies the:
Program to execute (PGM=LM of the program)
Procedure to execute (PROC=Name of the Proc)
(Certain programs like the language compilers which
perform
the same function for all its users, are converted to a
form called PROCEDURES)
d
D
S
R
C72
//Stepname EXEC <Positional Parameters>,<Keyword parameters>
The EXEC statement – a detailed look
Optional, but useful for referbacks and locating errors in the job’s reports
PGM or PROC
PARM,COND,TIME,REGION
//Step010 EXEC PGM=Load Module of a Program, Time=(,5)
//DDIN DD ……………….
//Step020 EXEC PROC=Procedure Name (or)
Procedure name
//Step030 EXEC PGM=LM of another program
d
D
S
R
C73
The EXEC Statement - PGM / PROC Syntax for Program / Procedure
PGM = Load Module Of User-written Application program. For load modules in user-load libraries, JOBLIB or STEPLIB must be coded.
PGM = Load module of Utility Program. Stored in system library, SYS1.LINKLIB.
Eg. SORT utility
PROC = Procedure Name. Stored in system library SYS1.PROCLIB. For PROCs in user-libraries, JCLLIB must be coded.
d
D
S
R
C74
The EXEC Statement - PGM / PROC contd..
Upto 255 steps can be under one JOB
If the load module is not found, the system will abend the step giving a completion code of 806.
Example:
//DSRC012A JOB NOTIFY=DSRC012
//STEP1 EXEC PGM=Load Module of Your Program
//………….........
//STEP2 EXEC PGM=SORT (the LM of Utility Program)
//……….............
//STEP3 EXEC PROC=Procedure Name
d
D
S
R
C75
The EXEC Statement - COND
Syntax for Condition.COND defines the conditions under which the OS
must execute a step. Also called Return code.
EXAMPLE:
//Cobol EXEC PGM=Igycrctl
//………..
//Lked EXEC PGM=Hewl,COND=(4,LT,COBOL)
Interpretation: If Condition is satisfied, Do Not Execute the Step
If Condition is not satisfied, Execute the step.
d
D
S
R
C76
The EXEC Statement - COND contd..
The Compile/Link-edit JCL:
//LKED EXEC PGM=HEWL,COND=(4,LT,COBOL)
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
compiler sets its condition code to 0005 or greater.
d
D
S
R
C77
The EXEC Statement - COND contd..
COND can be used for two reasons: 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.
d
D
S
R
C78
The EXEC Statement - COND contd..
Syntax in Normal Mode : COND=(Condition code value,Comparison operator,Stepname)
COND=(Condition code value, Comparison operator)
Condition code value - 0 to 4095.
Comparison operator - GT, LT, GE, LE, EQ, NE
Syntax in Abnormal Mode : COND=EVEN
COND=ONLY
d
D
S
R
C79
The EXEC Statement - COND 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 Inadequate Central storage (Region)
OC7 Data exception
d
D
S
R
C80
The EXEC Statement - COND contd..
Condition code values range from 0 to 4095. Any program that you execute, be it a utility program like
the language compiler, or your program, leaves a number
in this range. This number termed the Condition code
(CC) is also called the Return code (RC). Conventional condition code values for IBM supplied
compilers and utility programs:
CC 0000 Program execution was completely successful
CC 0004 Execution was OK but caused warning messages
CC 0008 Program execution was seriously flawed
CC 0012 Program execution was very seriously flawed
CC 0016 Program failed disastrously
d
D
S
R
C81
The EXEC Statement - COND contd..
Condition code values for your programs depends on the programming language:
PL/I CALL PLIRETC(Value);
C EXIT(Value);
COBOL MOVE <Value> to RETURN-CODE
MOVE <File status> to Return-Code.
d
D
S
R
C82
The EXEC Statement - COND contd..
//Step010 Exec Pgm=A1111
//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
//Step040 Exec Pgm=D4444,Cond=(4,Eq)
Pgm D4444 is not executed if pgm A1111 or pgm B2222 or pgm C3333 returns CC 0004
d
D
S
R
C83
The EXEC Statement - COND contd..
//Step010 Exec Pgm=Pgm1 CC 0000
//Step020 Exec Pgm=Pgm2 CC 0004
//Step030 Exec Pgm=Pgm3, Step not run
// Cond=(4,Eq,Step020) because of CC
//Step040 Exec Pgm=Pgm4,Cond=Even CC 0004
//Step050 Exec Pgm=Pgm5,Cond=Only Step not run due to
Cond=Only
//Step060 Exec Pgm=Pgm6 Abend SoC7
//Step070 Exec Pgm=Pgm7 Execution blocked by
Abend
//Step080 Exec Pgm=Pgm8,Cond=Only CC 0000
//Step090 Exec Pgm=Pgm9,Cond=Even CC 0000
//Step100 Exec Pgm=Pgm10,Cond=Even Step executed
Cond=Even and only
d
D
S
R
C84
The EXEC Statement - COND contd..
//STEP1 EXEC PGM=READ,COND=((4,GT),(6,LT))
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.
d
D
S
R
C85
The EXEC Statement - COND 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
If a Condition is not coded for a step and its previous step abends, then this step is by-passed.
d
D
S
R
C86
The EXEC Statement - COND 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
d
D
S
R
C87
The If/Then/Else/EndIf Statement
This construct is an alternative to coding COND; introduced in OS390.
Allows the outcome of one STEP to determine the execution of subsequent steps.
EXAMPLE:
// IF (STEP040.RC EQ 4) THEN
//STEP050 EXEC PGM=LM of a program
// ELSE
//STEP060 EXEC PGM=LM of another program
// ENDIF
d
D
S
R
C88
The If/Then/Else/EndIf Statement contd…
Syntax:
//Name IF (Relational expression) THEN
// Steps to processed when relational expression is true
//Name ELSE
// Step to processed when relational expression is false
//Name ENDIF
Name field is optional. Operation fields are IF,THEN, ELSE and ENDIF.
ELSE is an optional clause.
ENDIF marks the end of the statement.
d
D
S
R
C89
The If/Then/Else/EndIf Statement contd… Relational expression field consists of:
Comparison operators - GT, LT, NG, NL, EQ, NE, GE, LE
> < ¬> ¬< = ¬= >= <= Connect operators - AND, OR
& I NOT (¬) operators Keywords:
RC Indicates Return code
ABEND Indicates occurrence of Abend
¬ ABEND Indicates non occurrence of Abend
ABENDCC Indicates a specific system or user abend code
RUN Indicates execution of the specified Step
¬RUN Indicates non execution of the specified step
Examples:
// IF (RC > 8 & Step020.RUN) THEN……..
// IF ¬(Step020.RC > 8) THEN…..
d
D
S
R
C90
The If/Then/Else/EndIf Statement contd…
RC
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)
Indicates that the relational expression tests for an Abend condition that occurred in the job prior to the time of evaluation
IF ABEND THEN….. tests true when an abend occurred in any previous step.
d
D
S
R
C91
The If/Then/Else/EndIf Statement contd…
(ABENDCC EQ Sxxx) or (ABENDCC EQ Uxxxx)
Indicates that the relational expression tests for:
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)
Indicates that the relational expression tests that the specified step (vide stepname) has been executed.
d
D
S
R
C92
The If/Then/Else/EndIf Statement contd…
EXAMPLES:// IF (RC > 8 & RC < 16) THEN……..
// IF (RC = 8 I RC = 12 I RC > 24) THEN……….
// IF ¬(RC > 8) THEN…..
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: First the NOT operator followed by
Comparison operator and then the
Connect operator
// IF STEP6.RC EQ 1 AND ((STEP7.RC EQ 4 OR
// STEP8.RC EQ 1) OR STEP9.RC EQ 4) THEN …….
d
D
S
R
C93
The If/Then/Else/EndIf Statement contd…
You can nest IF/THEN…. statements up to 15 levels.
// IF NOT (STEP1.RC EQ 1 AND STEP2.RC EQ 1) THEN
// IF (STEP4.RC LE 4 AND STEP1.ABEND) THEN
//STEP060 EXEC PGM=Program ONE
// ELSE
//STEP070 EXEC PGM=Program TEN
// ENDIF
// ELSE
//STEP080 EXEC PGM=Program TWO
// ENDIF
d
D
S
R
C94
The EXEC Statement - TIME
Establishes a CPU time limit for a program to execute.
If the time limit is exceeded, the system abends the
step with a completion code of 322.
If not coded, the Time parameter takes a value that is
installation defined.
d
D
S
R
C95
The EXEC Statement - TIME 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 JOB TIME=(1,50)
//Step1 EXEC PGM=PROGRAM1,TIME=(0,30)
//Step2 EXEC PGM=PROGRAM2
//DSRC012A JOB TIME=(1,50)
//Step1 EXEC PGM=PROGRAM1,TIME=(1,50)
//Step2 EXEC PGM=PROGRAM2
d
D
S
R
C96
The EXEC Statement - TIME contd..
The limit on the JOB totals to the CPU time usage of all the steps.
//DSRC012A JOB TIME=(1,50)
//Step1 EXEC PGM=PROGRAM1,TIME=(1,50)
//Step2 EXEC PGM=PROGRAM2,TIME=(1)
Note: The OS ignores any limit on the EXEC which is larger than that
coded on the JOB statement.
d
D
S
R
C97
The EXEC Statement - REGION The Region parameter specifies the amount of virtual storage which the program (step) can use.
Can be specified in kilobytes(K) or Megabytes(M).
Format : Region=nK or nM
//Step1 EXEC PGM=SORT,REGION=5M
//…………….
//Step2 EXEC PGM=Load Module,REGION=3M
//…………...
d
D
S
R
C98
The EXEC Statement - REGION contd…
If REGION is coded on the JOB and EXEC, then the JOB limit overrides any REGION that is larger
//DSRC012A JOB NOTIFY=DSRC012,REGION=2M
//Step1 EXEC PGM=SORT,REGION=5M
//…………….
//Step2 EXEC PGM=Load Module,REGION=3M
//…………...
IF no REGION is coded, system default value or installation-defined default.
If a program requires more storage than coded, step fails with a system completion code of 804 or 80A.
Each step gets only 2M of storage
d
D
S
R
C99
The EXEC Statement - PARM
Syntax for Parameter.
Passes data to the load module that is being executed.
A maximum of 100 bytes of data can be passed.
The passed data can be: received by the program - through the program’s
Linkage section and used in the program - if “Procedure division using
Linkage section’s data- area” is coded.
d
D
S
R
C100
The EXEC Statement - PARM contd… Example :
1) Pass data vide PARM in the JCL:
//STEP010 EXEC PGM=Load Module,PARM=‘001 JOHN’
2) Access the data in a Cobol program:
IDENTIFICATION DIVISION.
DATA DIVISION.
LINKAGE SECTION.
01 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.
d
D
S
R
C101
The EXEC Statement – PARM contd…
Coding Rules: 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
d
D
S
R
C103
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 <Information about the dataset which the
above program uses>
//DDname2 DD ………do.…….
d
D
S
R
C104
The DD Statement contd..
The Information supplied, depends on whether the program: Reads from the dataset(s) or Writes into an existing dataset(s) //DDRd DD DSN=<Name of the dataset>,
// DISP=……..
Prints the dataset(s) //DDPrt DD SYSOUT=
Creates new dataset(s) //DDCrte DD DSN=<name of the dataset>,
// DISP=<whether the dataset is new or existing>,
// UNIT=<whether the dataset is to be stored on Disk or
Tape>,
// SPACE=<amount of disk-storage space required>,
// DCB=<information about how the data is to be
stored>
d
D
S
R
C105
The DD Statement contd..
Up to 3273 DD statements can be defined in a single Step.
//……. JOB …….
//…….. EXEC PGM=LM of a program
//DDname1 DD <Information about the dataset which the
above program uses>
//DDname2 DD ………do.…….
//DDname3 DD ………do……..
d
D
S
R
C106
What is a Dataset ?A store of data – Employee data, Customer data.
Each entity’s 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 - Physical sequential (PS) – DSRC012.Empdata Partitioned sequential (PDS) – DSRC012.Empdata(Member1) VSAM type (Sequential, Indexed, Relative) – DSRC012.BaseCluster
d
D
S
R
C107
The Disk Volume Table of contents - VTOC A Disk Volume is an assembly of magnetic platters which
provides millions of bytes of storage.
Each disk volume has a unique name called Volume Serial number.
d
D
S
R
C108
The Disk Volume Table of contents contd..
Recorded on each disk volume is the VTOC which is a dataset to keep track of all datasets stored on that volume.
The VTOC is one level above the level of PDS directory.
d
D
S
R
C109
The SYSTEM CATALOGHighest level of information above the level of VTOC.
The system catalog is a critical dataset on a special disk volume and contains information on where (on which disk volume) each dataset is stored.
Dataset Name Location (name of the Volume)
DSRC012.COBOL.PGMS ZTSO03
DSRC012.JCL.PGMS ZTSO01
d
D
S
R
C111
The DD Statement - a detailed look
//DDname DD <Positional parameters>,<Keyword parameters>
*
Data
Dummy or NullFile
Dsn,
Disp,
Unit,
Volume,
Space,
Dcb
Mandatory. If omitted, the dataset is concatenated with the one defined in the previous DD statement.
Sysout
d
D
S
R
C112
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 PGM=LM of a program
//DDname DD *
<…………..Instream data……..>
/*
d
D
S
R
C113
The DD statement - * contd..
Instream data to a Cobol program:
In the JCL:
//STEP010 EXEC PGM=LM of a Cobol program
//SYSIN DD *
001 JOHN …..
/*
In the Cobol program:
IDENTIFICATION DIVISION.
DATA DIVISION.
WORKING-STORGAE SECTION.
77 DATA1-IN PIC X(80).
PROCEDURE DIVISION.
ACCEPT DATA1-IN.
The load module can be User-written program or
Utility program.
d
D
S
R
C114
The DD statement - * contd..
Instream data to Utility programs:
//STEP010 EXEC PGM=SORT //………………………………… //………………………………… //SYSIN DD * SORT FIELDS=……… /*
The end of data is indicated by the delimiter - /*
The instream cannot contain // as data in columns 1,2
when * is used.
d
D
S
R
C115
The DD statement - DATA
DATA is functionally the same as ‘*’ operand, except
that instream data can contain // in columns 1,2
//STEPNAME EXEC PGM=LM of a program
//DDname DD DATA
………Instream data………..
………Instream data……….
/*
d
D
S
R
C116
The DD statement-Delimiter for Instream data
What if instream data consists of /* in columns 1 & 2
and, /* is used to delimit the instream data too ?
//SYSIN DD DATA/*abc…../*
Under such situations delimit vide the DLM parameter
which indicates the new delimiter to be used. DLM can be used for * and DATA
//SYSIN DD DATA, DLM=‘$$’/*abc…..$$
d
D
S
R
C117
The DD statement - DUMMY / NULLFILE
DUMMY assigns a ‘dummied’ status to a dataset: Any I/O requests on the dataset is bypassed No devices and space is allocated to the dataset
d
D
S
R
C118
The DD statement - Dummy / Nullfile contd..
WHY DUMMY ?
Used to test a program flow without actually processing the
dataset 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 EXEC PGM=IEBGENER //…… //SYSIN DD DUMMY
Any unwanted outputs listings can be suppressed.
Note: The other syntax is to code DSN=NULLFILE.
d
D
S
R
C119
The DD statement - Keyword Parameters
If data is to be accessed from Disk or Tape, the parameters are: 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
If data is to be sent to Terminal or Printer: SYSOUT parameter; none of the above.
//DDname DD SYSOUT=<Terminal>
d
D
S
R
C120
The DD statement - DSN
Syntax for Dataset Name
Names the full qualified name of the physical dataset
used by the load module.
Dataset name is maximum 44 characters long with a
period after every 8 characters (or less). Maximum
length is inclusive of period.
d
D
S
R
C121
The DD statement - DSN contd..
Classified into Permanent and Temporary datasets Permanent datasets are used as a data-store on disks
and tapes. 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.
A DSN coding without && indicates a Permanent dataset.
d
D
S
R
C122
The DD statement - DSN contd..
Code for Permanent dataset:
//DD8 DD DSN=DSRC12.EMP.DEVL
Code for Temporary dataset:
//DD8 DD DSN=&&TEMP
If the dataset (DSN) is not found in the system catalog,
the system throws a “JCL error”.
Dataset names (DSN) cannot be duplicated in the VTOC.
If duplicated, the system returns a “CC of 8”.
d
D
S
R
C123
The DD statement – DISP (Status)
Syntax for Disposition. DISP=({Status}{,Normal-disposition}{,Abnormal-disposition})
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.
Gains exclusive control of the dataset for the duration
of the step and safeguards against concurrent access to the
dataset.
Over-writes existing data. MOD – Extends the dataset (if existing) or creates a new one (if not
existing).
Gains exclusive control of the dataset. SHR – specifies that the dataset can be shared with other jobs
during the step.
d
D
S
R
C124
The DD statement - DISP(Normal termination) 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.
d
D
S
R
C125
The DD statement- DISP(Abnormal termination) contd..
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.
d
D
S
R
C126
The DD statement – DISP contd..
PDS and DISP
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
D
S
R
C127
The DD statement – DISP (Defaults) contd..
If DISP parameters are not coded, the following defaults:
DISP Coded as : Defaults to :If not coded ………………….(NEW,DELETE,DELETE)
(OLD)………………………...(OLD,KEEP,KEEP)
(SHR)…………………………(SHR,KEEP,KEEP)
(,CATLG)…………………….(NEW,CATLG,CATLG)
(MOD)……………………….. If dataset does not exist :
(NEW,DELETE,DELETE)
If dataset exists :
(OLD,KEEP,KEEP)
(MOD,CATLG,)……………..(NEW/OLD,CATLG,)
DELETE) DELETE)
Disposition of OLD deletes existing records from the dataset. So,
to append records, code MOD.
d
D
S
R
C128
The DD statement - UNIT
UNIT requests the type of device - Disk or Tape, required to store a
dataset.
SYNTAX :
UNIT=Hardware address 0C4
(or)
Device Model number 3390
(or)
Symbolic device Group name SYSDA
(or)
Virtual Input / Output VIO
d
D
S
R
C129
The DD statement – UNIT contd.. EXAMPLES:
//DDN DD DSN=DSRC012.New.DS,
// DISP=(NEW,CATLG,DELETE),
// UNIT=3390
//DDB DD DSN=…….
// UNIT=3480
Note: System Catalog entry may state DEVICE instead of UNIT.
Implies a disk drive based on
Model number
Implies a tape drive based on
Model number
d
D
S
R
C130
The DD statement – UNIT(Hardware Address) contd..
Hardware Address 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
d
D
S
R
C131
The DD statement – UNIT (Model Number) contd..Device Model number
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.
EXAMPLE: //DD8 DD DSN=DSRC012.New.DS,
// DISP=(NEW,CATLG,DELETE),
// UNIT=3390
d
D
S
R
C132
The DD statement – UNIT (Group Name) contd..Symbolic Group name
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).
d
D
S
R
C133
The DD statement – UNIT (VIO) contd.. Virtual Input / Output
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
VIO used to store: Work datasets, as in a compiler program Temporary datasets, used within a job
Cannot retain the datasets in VIO permanently. Lasts only for the duration of the job.
d
D
S
R
C134
The DD statement - UNIT (Volumes) 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:
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.
d
D
S
R
C135
The DD statement - UNIT contd..
Code UNIT only for New and existing Uncataloged datasets.
(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.
d
D
S
R
C136
The DD statement - UNIT contd..
While creating New datasets, if UNIT is not coded: Defaults to installation-defined devices based on purpose:
Unit Volume
For Development datasets 3390 ZTSO01
For Testing datasets 3391 ZRSO06
For SMS managed datasets, defaults to STORAGE CLASS:
Storage Class Unit Volume
SCTSO 3390 ZTSO03
d
D
S
R
C137
The DD statement- UNIT (Common problems) contd..Common problems with UNIT
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.
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.
d
D
S
R
C138
The DD statement - SPACE Specifies how much space to allocate for a new disk dataset.
Disk is often called DASD in the mainframe environment. Syntax:
SPACE=(S1,(S2,S3,S4),S5) 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) S5 - Releases the unused space requested
EXAMPLE:
SPACE=(TRK,(5,2)) You get 5 tracks + (2 X 15) tracks
= 35 tracks
d
D
S
R
C139
The DD statement – Space (CYL / TRK) contd..
Disk surfaces are divided into Tracks of recording space Group of tracks make a Cylinder Many cylinders make a disk Volume
d
D
S
R
C140
The DD statement - Space (CYL/TRK) contd..
Different models of IBM Mainframe disks have different track capacities, number of cylinders and device capacities.
Disk Bytes/Track Tracks/Cylinder Total Total
Volume Cylinders Bytes
Model
3390-1 56664 15 1113 0.946 Gb
3390-2 56664 15 2226 1.892 Gb
d
D
S
R
C141
The DD statement – Space (EXTENTS) 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 An EXTENT is a piece of disk space. Your primary space allocation is 1 extent. When you request SPACE=(TRK,(5,2)) you get:
1 primary extent and 15 secondary extents
5 tracks + (2 X 15) tracks
d
D
S
R
C142
The DD statement – Space (Block size) 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.
d
D
S
R
C143
The DD statement – SPACE (Record Length) contd.. Applicable only for SMS managed datasets Code AVGREC parameter along with Space parameter Do not code BLKSIZE in the DCB keyword parameter
//DDN DD DSN=DSRC012.DS,
// DISP=(NEW,CATLG,DELETE),
// UNIT=SYSDA,
// AVGREC=U,
// SPACE=(133,10000)
// RECFM=FB,
// LRECL=133
With AVGREC=U:
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.
You get (10000 records X 133 bytes) of space
d
D
S
R
C144
The DD statement – SPACE (Record Length) contd.. //DDN 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)
// AVGREC=M,
// SPACE=(133,10)
You get (10,000,000 records X 133 bytes) of space.
d
D
S
R
C145
The DD statement-SPACE (Directory Blocks) 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
tracks and create 7 Directory
blocks. Each directory block
can store information about 5
members; implies 35
members can be allocated.
Space=(TRK,(1,,7)) When you do not want
secondary space for the PDS.
d
D
S
R
C146
The DD statement - SPACE contd..
EXAMPLES:
//DDN DD DSN=…….,
// DISP=…..,
// UNIT=3390,
// Space=(TRK,10) Allocates a PS with 10 tracks of space.
Space=(TRK,(5,,1)) Allocates a PDS with no secondary
space and 1 directory block.
Space=(3840,(200,60)) Allocates (200 X 3840) + (60 X
3840 X 15) of disk space.
d
D
S
R
C147
The DD statement - SPACE 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 A PDS cannot span disk volumes
The limit of 16 extents per dataset per disk volume does not apply to VSAM datasets, which can exist with up to 123 extents
d
D
S
R
C148
The DD statement – SPACE (RLSE) contd..
Causes all of the whole unused tracks to be freed for use by other datasets
Syntax: SPACE=(6200,300,RLSE) Releases unused tracks.
SPACE=(6200,(300,60),RLSE) Releases unused tracks in the
last active secondary.
SPACE=(80,1,RLSE) No space is released since
space is less than a track for any disk volume model.
d
D
S
R
C149
The DD statement – SPACE (RLSE) contd..
RLSE does not work if a step abends
Does not work if the dataset is not closed normally
Does not work when the dataset is shared
d
D
S
R
C150
The DD statement - DCB Syntax for Data Control block
Specifies to the OS, the characteristics of the dataset used: Whether the records are of fixed length F
or variable length V
or Undefined length U The logical record length LRECL Size of record-blocks n * LRECL
d
D
S
R
C151
The DD statement – DCB (DCB merge) contd..
The OS uses this information to work on the datasets. The OS puts the information specified in this DCB parameter of the DD statement, into its own memory area called Data
Control Block. The OS actually uses this Data Control Block to work on the datasets. The OS gets information into its data control block from three sources and follows this sequence, called the DCB merge,
in seeking information into its data control block: The program being executed Your DCB parameter in the DD statement The label of the dataset (information in the VTOC)
If your program provides the OS all the information, then the
information specified in your JCL and in the dataset label is
ignored by the OS.
Provide the information vide DCB in JCL instead of program since, changing in JCL is easier – say, the BLKSIZE.
d
D
S
R
C152
The DD statement – DCB (RECFM) contd..
Syntax : DCB=(RECFM=F/FB/FBA/V/VB/VBA/U,
LRECL=n,
BLKSIZE=multiples of n)
FB Fixed length records and records are blocked VB Variable length and records are blocked U Undefined length A Used to control printers.
EXAMPLE: DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
Blocks 100 records; each record 80 bytes in length.
d
D
S
R
C153
The DD statement – DCB (LRECL) contd..LRECL – The length of the logical record
For fixed length records, the dataset contains records all of the same length and hence LRECL = the actual length of the data-bytes. LRECL for fixed length records can range from 1 to 32,760 bytes. You can access all 32,760 bytes.
For variable length records, the length of the records vary from an average to a maximum. So, the LRECL = longest data-bytes length + 4 bytes; the 4 bytes called the RDW(record descriptor word) is pre-pended to each record and indicates the actual length of the record in its first two bytes LRECL can be as high as 32,760 but only 32,752 are accessible.
For Undefined format, code LRECL=0. Conventionally used to store load modules.
d
D
S
R
C154
The DD statement – DCB (BLKSIZE) contd..
BLKSIZE – The size of a ‘block’ of records; otherwise called the Physical record. Blocking of records improves processing speed
d
D
S
R
C155
The DD statement – DCB (BLKSIZE) contd.. For fixed length blocked records (RECFM=FB)
Block size is multiples of LRECL. Must not be larger than 32,760 bytes.
Example: DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000)
For variable length blocked records (RECFM=VB) Block size is multiples of LRECL plus 4 bytes, for Block descriptor 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)
d
D
S
R
C156
The DD statement – DCB (BLKSIZE) contd..
For Undefined format (RECFM=U) records, let the OS
determine the block size.
DCB=(RECFM=U,LRECL=0)
d
D
S
R
C157
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.
d
D
S
R
C160
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 DSN=Jan.DS,DISP=SHR// DD DSN=Feb.DS,DISP=SHR// DD DSN=Mar.DS,DISP=SHR
Say, you want the OS to search several load module libraries for a member:
//STEP010 EXEC PGM=LM of a program
//STEPLIB DD DSN=DSRC012.LOADLIB1,DISP=SHR// DD DSN= DSRC012.LOADLIB2,DISP=SHR// DD DSN= DSRC012.LOADLIB3,DISP=SHR
d
D
S
R
C161
Rules for Concatenation The sequence in which the datasets are coded is the sequence in which they are concatenated We can concatenate PDS, PDS members and PS datasets, but not VSAM datasets. Cannot concatenate PDS
wholly with sequential datasets. All datasets must have the same RECFM. The LRECL must also be the same for fixed-length records. LRECL need not be same for variable-length records as long as you place the dataset with the longest LRECL
on the first DD 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.
d
D
S
R
C162
HOW TO CONCATENATE?Concatenate datasets by coding a DD statement for each dataset
//IN DD DSN=Jan.DS,DISP=SHR
// DD DSN=Feb.DS,DISP=SHR
// DD DSN=Mar.DS,DISP=SHR
DDname should be coded for the first DD statement only
If DUMMY dataset is coded, the rest of the datasets down are not processed
//DD1 DD DSN=A1.PDS,DISP=SHR// DD DUMMY// DD DSN=C1.PDS,DISP=SHR
d
D
S
R
C163
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:
DSN VOL DCB
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.
d
D
S
R
C164
EXAMPLE Referback on a DD statement
//DSRC012A JOB NOTIFY=DSRC012//STEP010 EXEC PGM=PGM1//DD1 DD DSN=EMP.PDS,DISP=(NEW,CATLG),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=800),
// …………………………
//DD2 DD DSN=INP.PDS,DCB=*.DD1, ……..
//STEP2 EXEC PGM=PGM2
//DD2 DD DSN=STU.PDS,DCB=*.STEP010.DD1, …..
Referback on a PGM parameter
//DSRC012A JOB NOTIFY=DSRC012//STEP010 EXEC PGM=HEWL
//SYSLMOD DD DSN=PDS(M1),DISP=SHR
//……………………..
//STEP020 EXEC PGM=*.STEP010.SYSLMOD
d
D
S
R
C166
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
If a STEPLIB is specified in a JOB that also has a JOBLIB, the STEPLIB takes precedence when searching for a program
d
D
S
R
C167
EXAMPLE
If two load modules are members of the same PDS then execute the load modules by
//DSRC012A JOB NOTIFY=DSRC012
//JOBLIB DD DSN=<PDS name>,DISP=SHR
//STEP1 EXEC PGM=<LM member name>
//………….
//STEP2 EXEC PGM=<LM member name>
//………….
The OS searches the JOBLIB DSN for the two load modules.
d
D
S
R
C168
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
JOBLIB / STEPLIB is used to specify private program libraries
d
D
S
R
C169
EXAMPLE If two load modules are stored as members of two different PDSs, then execute the load modules by
//DSRC012A JOB NOTIFY=DSRC012
//STEP1 EXEC PGM=<LM member name>
//STEPLIB DD DSN=PDS1, ……..
(where the above LM is stored)
//………….
//STEP2 EXEC PGM=<LM member name >
//STEPLIB DD DSN=PDS2, ……….
(where the above LM is stored)
//………….
The OS searches the respective STEPLIB DSNs for the two load
modules.
d
D
S
R
C170
SYSPRINT Specifies that an execution report of the load module (PGM) is required. It defines the output file containing the execution
messages.EXAMPLE:
//STEP1 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1……………
//
Note:
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.
d
D
S
R
C171
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 DD * or DATA, or DSNEXAMPLE:
//STEP2 EXEC PGM=LOAD1
//STEPLIB DD DSN=EMP.PDS,DISP=MOD
//SYSIN DD *
HELLO WORLD
/*
d
D
S
R
C172
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
d
D
S
R
C173
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:
//STEP010 EXEC PGM=LM of an Application program
//SYSUDUMP DD SYSOUT=Class
d
D
S
R
C174
SYSABEND
Used to request a dump similar to that of SYSUDUMP and
additionally the system nucleus.
d
D
S
R
C177
What is a Utility program? A program used by all users for the same purpose.
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.
Utility programs provide many useful functions Creating datasets Copying datasets Sequencing datasets Deleting datasets and so on
d
D
S
R
C178
IBM Utility programs contd…
IBM supplied utility programs that you run in batch are:
The IBM Utilities VSAM IDCAMS utility
Used only on normal Used on normal and VSAM
datasets datasets
Both the utilities’ functions can be and are easier done using TSO or ISPF
d
D
S
R
C179
Utility programs - IDCAMS contd…
The JCL statements for invoking the utility programs take the form: The IDCAMS Utility
//Stepname EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
This prints the IDCAMS messages
//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 *
Command statements
/*
REPRO -
INFILE(DDname1) -
OUTFILE(DDname2)
d
D
S
R
C180
Utility programs - IDCAMS contd…
The Commands perform the operations which include:
COMMAND OPERATION
DEFINE To allocate a dataset
REPRO To copy from one dataset to another
DELETE To delete a dataset
PRINT To print a dataset
RENAME To rename a dataset
LISTCAT To list the system catalog information on
datasets
d
D
S
R
C181
Utility programs – IBM Utilities contd… The JCL statements in IBM Utilities take the form:
//Stepname EXEC PGM=the utility program-name
//SYSPRINT DD SYSOUT=*
This prints the utility program’s messages
//SYSUT1 DD …………..
Based on the operation, specifies the input dataset
//SYSUT2 DD …………..
Specifies the output dataset based on the operation
//SYSIN DD *
Control Statements
/*
COPY INDD=SYSUT1,
OUTDD=SYSUT2
d
D
S
R
C182
Utility programs – IBM Utilities 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.
IEBCOPY Copies PDSs (use IDCAMS REPRO) and
Compresses a PDS
IEBCOMPR Compares datasets. Instead use the SUPERC
utility of ISPF which can be run on-line or in batch.
IEHLIST Lists DASD information. USE IDCAMS LISTCAT
statement instead.
d
D
S
R
C183
Utility programs – IBM Utilities contd…
IEHPROGM Renames, deletes, catalog and uncatalog
datasets, creates special datasets called
Generation data groups (GDG). Use IDCAMS
ALTER, DEFINE, DELETE statements instead.
IEBUPDTE Maintains PROCS and Source libraries.
IEFBR14 Allocates datasets. USE IDCAMS DEFINE
statement instead.
d
D
S
R
C184
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 )
d
D
S
R
C185
IEFBR14 - To create a new dataset (PS) contd..To create a ‘new and empty PS’ which is to store fixed length records each of 80 bytes.
//DSRC012A JOB NOTIFY=DSRC012//STEP010 EXEC PGM=IEFBR14//SYSPRINT DD SYSOUT=*//DDNEW DD 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.
d
D
S
R
C186
IEFBR14 – To create a new PDS contd..
To create an empty, New, Fixed PDS Dataset. In the Space parameter, code the directory blocks as:
// SPACE=(TRK,(1,1, number of directory blocks))
d
D
S
R
C187
IEFBR14 - Create PS with variable length records contd..
To create a new dataset with variable length records, the
longest record being 80 data-bytes.
In the DCB parameter, code:
// DCB=(LRECL=84,RECFM=VB,BLKSIZE=8404)
d
D
S
R
C188
IEFBR14 - For house-keeping on datasets
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IEFBR14//SYSPRINT DD SYSOUT=*//DDNEW DD DSN=DSRC012.NEW.DS,// DISP=(NEW,CATLG,DELETE),// SPACE=(TRK,(1,1)),// DCB=(LRECL=80,
// RECFM=FB,
// BLKSIZE=8000)
d
D
S
R
C189
IEBGENER Uses:
To copy sequential datasets To reformat records while copying
Can be compared to selecting specific columns
To specify conditions while copying Can be compared to selecting specific rows
To re-block copied records Changing the LRECL and BLKSIZE
To concatenate datasets To write instream data into a dataset
d
D
S
R
C190
IEBGENER – To copy contd..
To copy sequential datasets For backing-up purposes For expanding space allocation
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset to be Read from>
//SYSUT2 DD DSN=<Output dataset to be Written into>
//SYSIN DD DUMMY
// The input dataset can be a PS or a member of PDS The output dataset can also be a PS or a PDS member The input and output datasets can both be PS or PDS members Output datasets as PS apply to backing-up operations on tapes
d
D
S
R
C191
IEBGENER – To copy contd..
To copy an input sequential dataset to many members of a PDS Code Generate Maxname and Member name.
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset>
//SYSUT2 DD DSN=<Output PDS>
//SYSIN DD *
Generate Maxname=3
(To create 3 members in the output)
Member name=(mem1,mem2,mem3)
(mem1,mem2,mem3 will have the contents of sysut1)
/*
d
D
S
R
C192
IEBGENER - To Reformat data during copy contd.. By reformatting, you can select data-bytes to be output
Code Generate Maxflds and Record Field in the control statement (similar to Inrec Fields in Sort utility)
Say, to output only the Empnum and Salary data-bytes, in
the order of Salary and Empnum:
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset>
//SYSUT2 DD DSN=<Output dataset>
//SYSIN DD *
Generate Maxflds=2
Record field=(5,1,CH,6)
field=(5,46,CH,1)
(Length,Location in input,Format,Location in the output)
d
D
S
R
C193
IEBGENER - To Reformat data during copy contd.. And to have some character-literals in the output, say, two asteriks between Salary and Empnum fields (similar to ‘X’ in the
Sort utility), code Maxlits:
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset>
//SYSUT2 DD DSN=<Output dataset>
//SYSIN DD *
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)
d
D
S
R
C194
IEBGENER - To Reformat data during copy 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)
d
D
S
R
C195
IEBGENER – To specify conditions 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 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset>
//SYSUT2 DD DSN=<Output PDS>
//SYSIN DD *
Generate Maxgps=1
Record Ident=(5,’01000’,46)
(length,<condition>,start-byte)
d
D
S
R
C196
IEBGENER - To re-block records contd..Re-blocking can involve:
Altering the BLKSIZE sub-parameter of the DCB in the output Altering the LRECL too
Code GENERATE control statement
Say to alter the LRECL in output:
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<Input dataset>
//SYSUT2 DD DSN=<Output dataset>, …….
DCB=(LRECL=100,……..,BLKSIZE=10000)
//SYSIN DD *
Generate Maxflds=1
Record field=(80,1,CH,1)
/*
d
D
S
R
C197
IEBGENER – To concatenate datasets contd..
To concatenate two datasets (note the PGM and the SYSUT1 DD statements)
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=<First unsorted dataset>
// DD DSN=<Second unsorted dataset>
Concatenation
//SYSUT2 DD DSN=<The concatenated dataset>
//SYSIN DD DUMMY
//
•
d
D
S
R
C198
IEBGENER - To write instream data contd..
To write instream data into a dataset
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD *
<Instream data>……
/*
//SYSUT2 DD DSN=<Output dataset to be Written into>
//SYSIN DD DUMMY
//
d
D
S
R
C199
IEBCOPY – To copy as a PDSTo copy a PDS as a PDS
Often used to expand the space allocation or change the directory space. Say, to increase the directory blocks: //STEP010 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=Existing PDS name,DISP=(Shr,Delete)
(say, this PDS has 10 directory blocks)
//SYSUT2 DD DSN=New PDS name,
// ………………………………………
// SPACE=(TRK,(10,5,50),RLSE),…….
(you request 50 directory blocks)
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
/*
You can merge many input PDSs too. DDnames are necessary for merge.
d
D
S
R
C200
IEBCOPY contd..
You can further rename the new PDS to that of the deleted
PDS. Use IDCAMS ALTER command.
//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
ALTER <New PDS name> NEWNAME(Original dataset
name)
/*
d
D
S
R
C202
IEBCOPY contd..
Determining the IEBCOPY operation to be performed: To request a COPY operation, specify partitioned data sets as input and output
Used to expand the space allocation, change the directory space or change the blocking size.
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.
d
D
S
R
C203
IEBCOPY – To copy to a new PDS contd…
To copy selective members from a PDS to a new PDS
Use SELECT MEMBER or EXCLUDE MEMBER in the control
statement along with COPY operation. Select and Exclude are mutually exclusive.
//STEP010 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//SYSUT1 DD DSN=Existing PDS name,DISP=SHR
//SYSUT2 DD DSN=New PDS name,DISP=(New,Catlg),
// ……………………………
//SYSIN DD *
COPY INDD=SYSUT1,OUTDD=SYSUT2
SELECT MEMBER=(member1,member2……..)
/*
d
D
S
R
C204
IEBCOPY contd…
You can assign a new name to the copied member SELECT MEMBER=(member1,(member2,newname), ……..)
For a COPY operation on an PDS with members existing, you can replace identically named members in the output dataset
SELECT MEMBER=(member1,,R)
d
D
S
R
C205
IEBCOPY – To compress a PDS contd..
To restore unused space for use.
//STEP010 EXEC PGM=IEBCOPY
//SYSPRINT DD SYSOUT=*
//INOUT DD DSN=Existing PDS name,DISP=Old
//SYSIN DD *
COPY INDD=INOUT,OUTDD=INOUT
/*
Since input and output datasets are the same, must code COPY
control statement.
d
D
S
R
C206
IEBCOMPRUses
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.
To compare two PDSs:
//// //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.
d
D
S
R
C207
SORT Program - DFSortCan be invoked vide SORT verb in COBOL
Vide JCL you invoke as a job step
To sequence character data and numeric data in ascending or descending order Character data – sequenced from left to right; comprises aphabetic, alphanumeric and numeric characters. In
ascending order:
+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)
d
D
S
R
C208
SORT Program – DFSort contd…
To reformat data to be sorted Can be compared to selecting specific columns
To specify conditions for selecting data Can be compared to selecting specific rows
To concatenate datasets and sort
d
D
S
R
C209
SORT Program - To sequence a dataset 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 (+ comes before -)
b9, -9 (Blank comes before -)
b999, 0009 (Blank comes before zero)
As Numeric data
-9, +9 (-9 is less than +9)
-9, 9 (-9 is less than 9)
9, 999 (9 is less than 999)
d
D
S
R
C210
SORT Program - To sequence a dataset 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 ASCII
blank blank
.<(+I=&!…….=“ !”#…….()+,-./
a through z 0 through 9
A through Z :;< = >?@
0 through 9 A through Z
[\]……
a through z
{I}-
d
D
S
R
C211
SORT Program - To sequence a dataset contd.
To Sequence A Dataset Consider the following layout of a PS with fixed length
records:
Empno :starting at absolute byte 1, for 5 bytes long
Empname :at absolute byte 6, for 25 bytes long
Department :at absolute byte 31, for 15 bytes long
Salary :at byte 46, for 5 bytes long
d
D
S
R
C212
SORT -To sequence a dataset contd..
The PS being populated with the following records:
11111sujit admin 10000
55555danny marketing 15000
22222ajay admin 07000
33333mala projects 20000
d
D
S
R
C213
SORT -To sequence a dataset contd.. To sort in ascending order of Empno, the JCL is: //DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<the unsorted dataset>
//SORTOUT DD DSN=<The destination dataset name for
sorted data>
//SYSIN DD *
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),
Sequence of sorting (ascending)
d
D
S
R
C214
SORT -To sequence a dataset contd..
The sorted dataset will contain :
11111sujit admin 10000
22222ajay admin 07000
33333mala projects 20000
55555danny marketing 15000
Note: For VB records, the first data-byte is 5.
d
D
S
R
C215
SORT -To sequence a dataset contd.. The Sort control statement takes the form:
SORT FIELDS=(Sort-key1, Sort-key2, ……)
(Start, Length, Format, Order)
Starting Length of data Ascending,
data-byte to be sorted. Descending
position in the
record. Data-
bytes 1 to CH EBCDIC character
4092 only can AC ASCII character
be the start bytes FS Signed numeric character
in the sort-key. D1 User-defined data type.
The keys are listed from left to right in the major to minor order.
d
D
S
R
C216
SORT -To reformat data to be sorted contd..
By reformatting: 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: Before sort fields,INREC FIELDS to reformat the record before sorting After sort fields, OUTREC FIELDS to reformat the record after sorting
d
D
S
R
C217
SORT -To reformat data to be sorted contd..
Before sorting, to include only employee number and salary field and to sort in descending order of salary field:
//SYSIN DD *
INREC FIELDS=(1,5,46,5)-----------------------1111110000
SORT FIELDS=(6,5,CH,D) 5555515000
/* 2222207000
3333320000
The sorted dataset will contain:
3333320000
5555515000
1111110000
2222207000
d
D
S
R
C218
SORT -To reformat data to be sorted 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 :
//SYSIN DD *
INREC FIELDS=(1,5,5000, say length of 3)
SORT FIELDS=(6,3,CH,A)
/*
d
D
S
R
C219
SORT -To reformat data to be sorted 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:
//SYSIN DD * SORT FIELDS=(6,25,CH,A) ------------------------- 22222ajay……. OUTREC FIELDS=(1,5,46,5) 55555danny….. 33333mala……
11111sujith……
The output dataset will contain: 2222207000
5555515000
3333320000
1111110000
d
D
S
R
C220
SORT -To reformat data to be sorted 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)
The output dataset will contain: 22222 07000
55555 15000
33333 20000
11111 10000
Two spaces
d
D
S
R
C221
SORT – To specify conditions 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)
Code before Sort Fields and Inrec Fields
//SYSIN DD *
Include / Omit Cond=
Inrec Fields=
Sort Fields=
/*
Decimal constant 12,-16,222,46
Hexadecimal “ X’nnnn…nn’
Character “ C’character-literals’
d
D
S
R
C222
SORT – To specify conditions 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,C’1000) SORT FIELDS=(1,3,CH,A)/*
Conversely, Omit Cond can be used to exclude employees with salary of 1000.
INCLUDE and OMIT are mutually exclusive
Can use connect operators AND and OR to form several logical conditions
d
D
S
R
C223
SORT - To concatenate datasets & sort contd.. To Merge two unsorted datasets into one sorted dataset (note the SORTIN DD statements and the control statement)
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<First Unsorted Dataset>
// DD DSN=<Second Unsorted Dataset>
Concatenation
//SORTOUT DD DSN=<SORTED DATASET>
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
d
D
S
R
C224
SORT - To concatenate datasets & sort contd..To Merge two datasets using MERGE FIELDS instead SORT FIELDS
Requires sorting of the datasets to merge.(Note the two SORTIN DD statements and the control statement)
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN01 DD DSN=<First Sorted dataset>
//SORTIN02 DD DSN=<Second Sorted dataset>
//SORTOUT DD DSN=<SORTED DATASET>
//SYSIN DD *
MERGE FIELDS=(1,5,CH,A)
/*
d
D
S
R
C225
DFSORT – Merge Fields
It is erroneous to ‘merge’ (MERGE FIELDS) two
datasets of varying LRECL 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
d
D
S
R
C227
PROCEDURE (PROC) – What is it ?JCL used repeatedly by several users to perform the same function.
Say language compiler and linkage editor programs
//Cobol EXEC PGM=IGYCRCTL//SYSIN DD DSN=COBOL source pgm//…………other DD statements…………
//SYSLIN DD DSN=OBJECT module//Lked EXEC PGM=IEWL//SYSLIN DD DSN=OBJECT Module//…………other DD statements………….
//SYSLMOD DD DSN=LOAD Module
d
D
S
R
C228
PROCEDURE (PROC) – What is it ? contd…
Consider Utility programs
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<Unsorted Dataset Name>
//SORTOUT DD DSN=<Sorted Dataset Name>
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
d
D
S
R
C229
Why do we need PROCS ?
No repetitiveness of same code by all users
Eliminates coding errors
d
D
S
R
C230
Converting a JCL to PROC
8 steps to convert a JCL to a Procedure First code an Instream Procedure Then convert the Instream Procedure to a Cataloged
Procedure
d
D
S
R
C231
Step1 – Test the ‘Raw’ JCL code
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<Unsorted Dataset Name>
//SORTOUT DD DSN=<Sorted Dataset Name>
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
//
d
D
S
R
C232
Step 2 – Code PROC / PEND statements Separate the JOB statement from the remaining JCL statements, with a PROC operation giving the PROC a name.
//DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<Unsorted Dataset Name>
//SORTOUT DD DSN=<Sorted Dataset Name>
//SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
// PEND
//
Separate the null statement(//) from the JCL with a PEND statement.
d
D
S
R
C233
Step 3 – Remove control statements Remove any control statement and put it into a member of a PDS.
//DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SORTIN DD DSN=<Unsorted Dataset Name>
//SORTOUT DD DSN=<Sorted Dataset Name>
//SYSIN DD DSN=<PDS(Mem1)>, DISP=SHR
// PEND
//
Change the JCL to refer to that dataset.
SORT FIELDS=(1,5,CH,A)
d
D
S
R
C234
Step 4 – Use Symbolic parameters (&) Replace the parameter-values that will change from run to run with SYMBOLIC parameters (&), which are place holders
for the actual values.
//DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&Unsorted Dataset
//SORTOUT DD DSN=&Sorted Dataset
//SYSIN DD DSN=&PDS(Mem1), DISP=SHR
// PEND
//
d
D
S
R
C235
Step 5 – Code default values for Symbolics If applicable, code default values for the symbolic parameters, on the PROC statement.
//DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC To=‘ * ’
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&Unsorted Dataset
//SORTOUT DD DSN=&Sorted Dataset
//SYSIN DD DSN=&PDS(Member), DISP=SHR
// PEND
//
d
D
S
R
C236
Step 6 – Test the PROC instream the job Code, ‘EXEC the Proc-Name’ and assign the actual values to the symbolic placeholders.
//DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC To=‘ * ’
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&Unsorted Dataset
//SORTOUT DD DSN=&Sorted Dataset
//SYSIN DD DSN=&PDS(Member), DISP=SHR
// PEND
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,
// PDS(Member)=‘Name’
This is called an INSTREAM PROCEDURE. You can code 15 instream procs in 1 job.
d
D
S
R
C237
Step 7 – Make Instream to Cataloged PROC Remove the JOB Statement //DSRC012A JOB NOTIFY=DSRC012
//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
// PEND
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,
// PDS(Member)=‘Name’
Remove the PEND and other statements thereafter
Save code in a private PDS member to evolve a cataloged procedure in user private library, or save in the system library SYS1.PROCLIB.
d
D
S
R
C238
Step 8 – Test the Cataloged Proc Code an invoking JCL
Code JCLLIB ORDER statement for Cataloged procedures stored in user private libraries.
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged Procedure>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,
// PDS(Member)=‘Name’
//
d
D
S
R
C239
Using a Procedure Users invoke a Proc by coding ‘EXEC Proc-Name or
PROC=Proc-Name’ Based on the users’s 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 Adding new parameters to the EXEC and DD statements in the procedure
//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
d
D
S
R
C240
Assigning values to symbolic parameters //SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged Procedure>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,
// PDS(Member)=‘Name’
d
D
S
R
C241
Overriding the parameters of the Exec and DD
//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT,Time=(,1)
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged PROC>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,Time.PSTEP010=(,5)
//PSTEP010.SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
// Proc’s Stepname . DDname
Parameter. Proc’s Stepname
d
D
S
R
C242
Nullifying the parameters of the Exec and DD Code as with Overriding the parameters but do not pass the value
Code just an equal (=) sign after the parameter
//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT,Time=(,1)
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged PROC>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,Time.PSTEP010=
//PSTEP010.SYSOUT DD SYSOUT=
//
d
D
S
R
C243
Adding new DD statements to the PROC//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member), DISP=SHR
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged PROC>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’
//PSTEP010.SYSIN DD *
SORT FIELDS=(1,5,CH,A)
/*
//
Proc’s Stepname . DDname
d
D
S
R
C244
Adding new parameters to the EXEC and DD Code as with overriding the parameters and pass the values.
//SORTPROC PROC To=‘ * ‘
//PSTEP010 EXEC PGM=SORT
//SYSPRINT DD SYSOUT=&To
//SYSOUT DD SYSOUT=&To
//SORTIN DD DSN=&UNSORTED DATASET
//SORTOUT DD DSN=&SORTED DATASET
//SYSIN DD DSN=&PDS(Member)
//DSRC012A JOB NOTIFY=DSRC012
// JCLLIB ORDER=<Location of Cataloged PROC>
//STEP010 EXEC PROC=SORTPROC,
// Unsorted dataset=‘Name’,
// Sorted dataset=‘Name’,
// PDS(Member)=‘Name’ // Time.PSTEP010=(,5)
//PSTEP010.SYSIN DD DISP=SHR
//
No TIME parameter
No DISP parameter
d
D
S
R
C245
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. There can exist a maximum of 15 nested ‘PROC statements’ – PROC operation
If each procedure resides in 15 different PDS, then the JCLLIB ORDER must identify those PDS to the OS.
Restart a PROC - Syntax <Job’s Step name . PROC’s Step name> Forward reference – Syntax - //DDName DD DDName=‘fwd’
Then use ‘fwd’ in the name field on any subsequent DD statement
In the invoking JCL of PROCs, overriding statements must come before add-on statements Override DD statements in the order of their occurrence within the PROC.
d
D
S
R
C246
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
D
S
R
C248
Use of Generation Data Groups A Generation Data Group (GDG) is used for processing data sets that are to be created on a periodical
basis – monthly or weekly or daily or hourly.
Examples : 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.
d
D
S
R
C249
Referring a GDGAll generations have the same dataset name.
Referred to by the name and a ‘relative generation number ‘
DSN=DSRC012.Tax.State(0) the current tax report
DSN=DSRC012.Tax.State(-1) last year’s tax report
You add a new generation by calling it:
DSN=DSRC012.Tax.State(+1) new generation
Upto 255 relative generations can exist and must be cataloged.
Generations of a GDG are sequential and can reside on disk or tape.
d
D
S
R
C250
Advantages of GDG No need to change the JCL between runs
The same DD statements can be used to create each new generation //STEPCRTE EXEC PGM=IEFBR14
//DD1 DD DSN=DSRC012.Tax.State(+1),
// DISP=(NEW,CATLG),
// SPACE=(TRK,(1,5),
// DCB=DSRCO12.MODL.MODL
The system keeps track of adding and deleting successive generations
d
D
S
R
C251
Catalog entry for a GDG In the system catalog, each generation has a name with its ‘absolute
generation number’ GDGname.GaaaaVnn, where
aaaa – absolute generation number, 0001 to 9999
nn – version number, 00 to 99
d
D
S
R
C252
3 steps to Create a GDG Create an entry for the GDG in the system catalog
This entry is called the GDG Base - DSRC012.BASE.GDG
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.
Create the new dataset belonging to a group -
DSN=DSRC012.BASE.GDG(+1)
d
D
S
R
C253
CREATING THE GDG BASE Use the IDCAMS utility - DEFINE command
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IDCAMS
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
DEFINE GDG(NAME(DSRC012.BASE.GDG)-
LIMIT(3)-
EMPTY-
SCRATCH)
/*
// NAME
LIMIT
EMPTY / NOEMPTY
Scratch / NoScratch
OWNER
TO / FOR
d
D
S
R
C254
CREATING THE GDG BASE contd…
NAME : A GDG name can contain maximum of 35 characters
(Since the GnnnnV00 take up 9 positions we have to keep the name to 35 or less characters)
LIMIT : Specifies how many GDS's (generations) are to be maintained in a group. (Maximum 255)
NAME and LIMIT are the mandatory parameters while defining the GDG base
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). NOEMPTY is the default
d
D
S
R
C255
CREATING THE GDG BASE contd…
SCRATCH / NOSCRATCH : Specifies whether or not OS should scratch (physical deletion) GDS's as they are removed from the group. NOSCRATCH is the default
OWNER : Specifies 1 to 6 character owner-id for the GDG.
TO & FOR : Specifies the expiration date TO(yyyyddd) or a retention period FOR(dddd) for the GDG
d
D
S
R
C256
CREATING THE MODELUse the IEFBR14 utility
//STEP020 EXEC PGM=IEFBR14
//DD1 DD DSN=DSRC012.MODL,
// DISP=(NEW,CATLG),
// SPACE=(TRK,0),
// DCB=(LRECL=80,RECFM=FB)
d
D
S
R
C257
CREATING THE MODEL 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.
d
D
S
R
C258
Creating the new generation datasetUse IEFBR14 utility or a user-written application program
//DSRC012A JOB NOTIFY=DSRC012
//STEP010 EXEC PGM=IEFBR14
//DD1 DD DSN=DSRC012.BASE.GDG(+1),
// DISP=(NEW,CATLG),
// SPACE=(TRK,(1,5),
// DCB=DSRCO12.MODL
d
D
S
R
C259
Creating the new generation dataset 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.
d
D
S
R
C260
Creating the new generation dataset 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. +ve numbers refer to generations not yet created:
DSN=GDGname(+1)
DSN=GDGname(+2),.....).
d
D
S
R
C261
Absolute and Relative generation numbers
Consider 3 generations in the catalog:
DSRC062.BASE.GDG
DSRC062.BASE.GDG.G0001V00 (-2)
DSRC062.BASE.GDG.G0002V00 (-1)
DSRC062.BASE.GDG.G0003V00 (0)
CURRENT GENERATION
PREVIOUS GENERATION
OLDEST GENERATION
ABSOLUTE GENERATION NUMBER RELATIVE NUMBER
d
D
S
R
C262
Retrieving a generation dataset
To retrieve an individual dataset, code the dataset name along with the relative generation number
If the dataset is coded without the generation number, then all the generations in that group will be concatenated and retrieved
d
D
S
R
C263
Deleting a generation dataset
The system will automatically delete the individual GDS as per the GDG
base ‘definition’
We can also delete a specific generation by coding DISP=(Old,Delete)
To delete the GDG Base we have to use IDCAMS command
d
D
S
R
C264
GDG NotesIf:
//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.
d
D
S
R
C265
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 -----
d
D
S
R
C266
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
• 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?
d
D
S
R
C267
Q & A //ddname DD DATA and //ddname DD * are equivalent
a) Always 0%
b) When using default delimiters only 100%
• To Create a GDG Dataset we can use both IDCAMS & IEHPROGM
• The STEPLIB statement cannot be used in a cataloged procedure - False
• Recall points on control cards used in SORT• SORTWKnn
• SORT FIELDS=COPY• If you code both SORT KEY and COPY it is a definer error
• MERGE FIELDS
• SUM FIELDS=NONE,XSUM (SORTOFnn)
• All abend codes