DD statement
The JCL line that connects a name inside a program to a real dataset.
Also written //DD, data definition
Why it matters. A program never names a real file. It uses a short name, and the DD statement says which dataset that name means today.
See it
An existing dataset. SHR lets others read it too.
Syntax
//ddname DD DSN=dsname,DISP=(status,normal,abnormal) //ddname DD SYSOUT=class //ddname DD * (data follows, ended by /*) //ddname DD DUMMY
- DSN
- The dataset. For a library, add the member in brackets.
- DISP
- State of the dataset and what to do with it afterwards.
- SYSOUT
- Send the output to the spool.
- SPACE, UNIT, VOL
- Where and how much to put a new dataset.
- RECFM, LRECL, BLKSIZE
- The shape of a new file, or the DCB parameters.
- DUMMY
- No data: reads end at once, writes are thrown away.
Try it DD
- 1
You're editing job CUSTCOPY, a copy step. Write the DD statement that gives the input name SYSUT1 the dataset ZBANK.DATA.CUSTOMER. Share it, so other jobs can read it too.
JCL //SYSUT1 DD DSN=ZBANK.DATA.CUSTOMER,DISP=SHR - 2
Submit the job CUSTCOPY from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(CUSTCOPY)' - 3
Read the step messages, JESYSMSG. Find the line for SYSUT1.
OUTPUT CUSTCOPY JESYSMSG
Remember
- A DD statement links a program's name to a real dataset.
- DSN= is the dataset. DISP= is how to use it.
- The same program can read test data one day and live data the next. Only the DD changes.
The usual mistake
//SYSUT1 DD DSN=ZBANK.DATA.CUSTOMR,DISP=SHR
The name has a typo. The system cannot find that dataset, so the job ends before the step starts: IEF212I, DATA SET NOT FOUND.
//SYSUT1 DD DSN=ZBANK.DATA.CUSTOMER,DISP=SHR
On real z/OS
MF/OS reads DSN, DISP, SYSOUT, DUMMY, in-stream data and the common attributes. It ignores UNIT and VOL, does not support LABEL, FREE=CLOSE or LIKE, and treats CATLG as KEEP in its own database. Device numbers such as 0A80 in IEF237I are placeholders.
Where can I practise DD statement?
Right here, at ZedBank. You take a junior job at a simulated bank and use DD statement in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.
- DispositionThe DISP parameter, which says whether a dataset already exists, and what to do with it when the step ends normally or fails.
- SYSOUTOutput sent to the spool rather than to a dataset, where you can read it after the job finishes.
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- Space allocationReserving disk space for a dataset up front, in tracks, cylinders or blocks, with room to grow.
- EXEC statementThe JCL statement that starts a step by naming the program or procedure to run.