JCLbeginner

Dataset Disposition (DISP) Deep Dive

Fully understand the three-part DISP parameter — status, normal termination, abnormal termination — and how it governs dataset access and lifecycle.

DISP packs three independent decisions into one parameter, which is why it is the JCL parameter most likely to be got wrong.

DISP is a three-line note left on a shared conference room whiteboard: whether you're booking a new room or joining one already reserved (status), what to do with the whiteboard notes if the meeting goes well (normal disposition), and what to do with them if the meeting gets cancelled halfway through (abnormal disposition).

Key Concepts

1
    DISP=(status, normal-end, abend)
2
Status: what the dataset is right now.
    NEW   create it. Fails if it already exists.
    OLD   it exists, and I want exclusive access. Others wait.
    SHR   it exists, and others may read it at the same time.
    MOD   append to it; create it if absent.
3
SHR on a dataset you write to is a real bug. It permits two jobs to write concurrently with no serialisation, and the result is interleaved or lost records with no error anywhere. SHR is for reading.
SHR
4
MOD has a trap. If the dataset does not exist, MOD behaves as NEW — so a typo in the name creates an empty dataset and appends to that, while the real one sits untouched. The job succeeds and yesterday's data is gone from the output nobody checked.
MODNEW
5
Normal disposition: what happens when the step ends cleanly.
    KEEP    keep the dataset, do not catalog it
    CATLG   keep it and record it in the catalog, so it is
            findable by name alone
    DELETE  remove it
    PASS    keep it for a later step in THIS job; it disappears
            at job end
6
PASS is how a work file moves between steps without being catalogued. KEEP without CATLG leaves a dataset that exists and cannot be found by name, which on modern systems is almost always a mistake.
PASSKEEPCATLG
7
Abnormal disposition: what happens if the step abends. Same options, applied only on failure.
8
The comparison that is always asked.
    DISP=(NEW,CATLG,DELETE)   create; catalog on success;
                              on failure, remove the partial file
    DISP=(NEW,CATLG,CATLG)    create; catalog either way --
                              including a half-written file
9
The second leaves a catalogued dataset that looks complete and is not. A later job reads it, or a person finds it and trusts it. The first is what you want almost every time.
10
Defaults, which bite. Omitting parts of DISP fills them in: DISP=SHR means (SHR,KEEP,KEEP), and DISP=(NEW) means (NEW,DELETE,DELETE) — so a new dataset with no normal disposition is deleted at the end of the step. That surprises people whose output has vanished.
DISPDISP=SHR(SHR,KEEP,KEEP)DISP=(NEW)(NEW,DELETE,DELETE)
11
Write all three parts on anything that matters.
12
What the interviewer is probing.1. "What are the three DISP positions?" Probing: the fundamentals. Stalls: "Status." *Moves up:* status at open, normal disposition, and abnormal disposition — the third is what protects you when a step fails.
13
2. "What does DISP=SHR risk?" Probing: the concurrency point. Stalls: "Nothing." Moves up: other jobs can read it concurrently, so writing under SHR can corrupt data — OLD is the exclusive option.
14
3. "What is the difference between CATLG and KEEP?" Probing: the distinction. Stalls: "Nothing." Moves up: KEEP retains the dataset but not its catalog entry, so later steps must supply volume and unit — the usual cause of a not-found failure.
15
4. "What does DISP=MOD do?" Probing: the detail. Stalls: "Modify." Moves up: positions at the end to append, creating the dataset if it does not exist — which is how a step can silently create an unexpected file.