Disposition
Says what state a dataset is in now, and what happens to it when the step ends well or badly.
Also written DISP
Why it matters. A wrong disposition keeps a file you wanted to delete, deletes one you wanted to keep, or stops another job from reading it.
See it
SHR: the dataset exists. Others may read it at the same time.
Syntax
DISP=(status,normal,abnormal) DISP=SHR DISP=(NEW,CATLG,DELETE) DISP=(MOD,PASS)
- NEW
- Make it now. The step has it alone.
- OLD
- It exists. The step has it alone.
- SHR
- It exists. Other jobs may read it too.
- MOD
- Add to the end. If it does not exist, make it.
- KEEP / DELETE / CATLG / UNCATLG
- What to do at the end of the step.
- PASS
- Hand it to a later step of the same job. Normal ending only.
Try it DISP
- 1
You're editing job MAKEWORK. Write the DD statement that makes the new file ZB0001.DEV.WORK. Keep it and put it in the catalog if the step works. Delete it if the step fails.
JCL //NEWDD DD DSN=ZB0001.DEV.WORK,DISP=(NEW,CATLG,DELETE) - 2
Submit the job MAKEWORK from your DEV JCL library.
SUBMIT 'ZB0001.DEV.JCL(MAKEWORK)' - 3
Read the step messages, JESYSMSG. Find what happened to the new file.
OUTPUT MAKEWORK JESYSMSG
Remember
- DISP=(status,normal,abnormal).
- Status: NEW makes it, OLD takes it alone, SHR shares it, MOD adds to the end.
- Normal and abnormal: KEEP, CATLG, UNCATLG or DELETE. Leave out the third part and an abend uses the second. With only NEW, the file is deleted at the end.
The usual mistake
DISP=NEW for a file you want to keep
With only NEW, the file is deleted when the step ends. Nothing tells the system to keep it.
DISP=(NEW,CATLG,DELETE)
On real z/OS
MF/OS treats CATLG and UNCATLG as KEEP in its own database, and has one volume. The defaults match z/OS: a dataset the step creates is deleted unless you keep it; an existing one is kept; a missing abnormal part uses the normal one (PASS becomes KEEP). A second DISP=(NEW,CATLG) for a name already cataloged fails, as on z/OS, with IGD17101I.
Where can I practise Disposition?
Right here, at ZedBank. You take a junior job at a simulated bank and use Disposition in real work, with Zed beside you. There's nothing to install.
Start at ZedBankRelated
- DD statementThe JCL statement that connects a name inside a program to a real dataset outside it.
- DatasetWhat a mainframe calls a file: a named collection of records with a defined structure, rather than a loose stream of bytes.
- CatalogThe system's index of where datasets live, so you can refer to a dataset by name without knowing which disk it is on.
- Job stepOne program execution within a job. A job is simply a sequence of steps that run in order.
- JCLJob Control Language: the language used to tell the mainframe what programs to run, in what order, and with what files.
- Generation data groupA set of datasets holding successive versions of the same file, so today's copy, yesterday's and last week's all exist under one name.