JCLbeginner
DD Statements and Dataset Allocation
Understand how DD statements connect a program's logical file references to physical datasets, devices, and allocation parameters.
A DD statement connects a name the program uses to an actual dataset. It is the most-tested thing in JCL because every job question eventually reaches it.
A DD statement is like the shipping label and handling instructions taped to a box — it doesn't just name the box (DSN), it tells the courier whether to open a brand-new box, reuse one already in the warehouse, and what to do with it if the delivery truck crashes en route.
Key Concepts
1
//CUSTFILE DD DSN=PROD.CUSTOMER.MASTER,DISP=SHR2
CUSTFILE is the DD name — what the COBOL ASSIGN clause or the utility's control statement refers to.
Everything after it says which dataset and under what terms.
CUSTFILEASSIGN
3
Every DD answers three questions.
DSN= which dataset
DISP= what state it is in, and what to do with it afterwards
SPACE= how much room, if it is new4
A new dataset needs more.
//OUTFILE DD DSN=PROD.DAILY.EXTRACT,
// DISP=(NEW,CATLG,DELETE),
// SPACE=(CYL,(50,10),RLSE),
// DCB=(RECFM=FB,LRECL=200,BLKSIZE=0)5
SPACE=(CYL,(50,10),RLSE) is 50 cylinders to start, 10 more each time it fills, and release what was not
used. Under-allocate the secondary and the job abends part-written with a space abend — one of the most
common batch failures.
SPACE=(CYL,(50,10),RLSE)
6
DISP is where most mistakes happen, and it has three parts:
DISP
7
DISP=(NEW,CATLG,DELETE)
| | |
| | what to do if the step ABENDS
| what to do if the step ends NORMALLY
current state8
Read that as: create it; if we finish, catalog it; if we crash, delete it. That last part is the point —
it stops a half-written file being left where a later job might read it as complete.
9
Other things a DD can be.
//SYSPRINT DD SYSOUT=* print output, viewed in SDSF
//SYSIN DD * instream data follows
control statements here
/*
//SYSOUT DD DUMMY discard it entirely10
DUMMY satisfies a program that insists on a file while doing no I/O at all — useful for suppressing
output you do not want.
DUMMY
11
Concatenation: several datasets read as one. Omit the DD name on the following statements:
12
//SYSLIB DD DSN=MY.COPYLIB,DISP=SHR
// DD DSN=PROD.COPYLIB,DISP=SHR
// DD DSN=SYS1.MACLIB,DISP=SHR13
They are searched in order, which is exactly how a local copybook overrides the production one — and
exactly how a stale library in the wrong position silently wins.
14
The operational point worth making. DISP is a contract covering both the success and the failure
path. Writing DISP=(NEW,CATLG,CATLG) means a crashed, partly-written dataset is catalogued and left
behind for somebody to find later and trust.
DISPDISP=(NEW,CATLG,CATLG)
15
What the interviewer is probing.1. "What does a DD statement connect?" Probing: the fundamentals. Stalls: "A file." *Moves
up:* the program-internal file name to a real dataset, which is why the same program can run against
test and production data unchanged.
16
2. "What do SPACE parameters mean?" Probing: the detail. Stalls: "The size." Moves up:
primary and secondary allocation in the given unit, plus a directory block count for partitioned
datasets — too small a primary means an abend on extend.
17
3. "What does DISP=(NEW,CATLG,DELETE) say?" Probing: practical reading. Stalls: "Create it."
Moves up: create it now; catalog it if the step ends normally; delete it if the step abends — the
third value is why failed runs leave no half-written file.
18
4. "What is DD DUMMY for?" Probing: the technique. Stalls: "Nothing." Moves up: satisfying
a DD the program opens but you do not want written — reads hit end of file immediately and writes
are discarded.