DD DISP Parameter


The DISP parameter specifies how a dataset is to be handled in the job or job step. DISP parameter also tells the system what to do with the dataset after the job step execution.

DISP stands for DISPOSITION and is an optional parameter.

Syntax -

DISP=(status
   [,normal-termination-action]
   [,abnormal-termination-action])

status -


STATUS is used to specify the state of the dataset. The status parameter valid values are -

Status Description
NEWSpecifies that a new dataset is to be created.
If the dataset already exists, an error will occur.
The default value if the status is ignored.
SHRSpecifies the dataset already exists before the step and used only for reading.
Other jobs can share the dataset and use the dataset parallelly.
OLDSpecifies the dataset already exists and used with exclusive control on the dataset.
If the dataset not exists, steps execution fails.
The step takes exclusive (unshared) control of the dataset and other datasets can't use the dataset parallelly.
MODSpecifies the dataset already exists before and used to append the data to the dataset.
If it does not exist, a new dataset gets created.
The records are to be added to the end of the dataset.
The dataset should be sequential.

Normal-termination-action -


It specifies the system what action needs to be taken on the dataset when the job step completed successfully. Below actions are valid on the dataset when the job step execution is successful -

Status Description
KEEPSpecifies the dataset is to be retained if step execution is successful.
KEEP will not modify any memory allocations done earlier.
CATLGSpecifies the dataset is to be cataloged if it is not already cataloged.
UNCATLGSpecifies the dataset is to be uncataloged if step execution is successful.
UNCATLG does not delete the data from the uncataloged dataset.
UNCATLG performs below two tasks -
  • Removes entry in the system or user catalog for the dataset.
  • All unneeded indexes get deleted.
PASSSpecifies the dataset should pass and used in the further steps.
DELETESpecifies the dataset is to be deleted if step execution is successful.
If the EXPDT and RETPD are set for the dataset, the datasets will be kept and DISP parameter ignored.

Abnormal-termination-action -


It tells the system what action needs to be performed on the dataset when the step execution is unsuccessful (terminates abnormally).

Below actions are valid on the dataset when the job step execution is unsuccessful -

Status Description
KEEPSpecifies the dataset is to be retained on the volumne if step execution is unsuccessful.
KEEP will not modify any memory allocations done earlier.
CATLGSpecifies the dataset is to be cataloged if it is not already cataloged.
UNCATLGSpecifies the dataset is to be uncataloged if step execution is unsuccessful.
UNCATLG does not delete the data from the uncataloged dataset.
DELETESpecifies the dataset is to be deleted if step execution is unsuccessful.
If the EXPDT and RETPD are set for the dataset, the datasets will be kept and DISP parameter ignored.

Default and overrides -

  • If the status is ignored, the default is NEW.
  • If the normal-termination-action is ignored, the default is DELETE for a NEW dataset and KEEP for an existing dataset. i.e., DISP=(NEW,DELETE,) for new and DISP=(OLD,KEEP,) for existing datasets.
  • If the abnormal-termination-action is ignored and the normal-termination-action is coded as PASS, the default is DELETE for a NEW dataset and KEEP for an existing dataset. i.e., DISP=(NEW,PASS,DELETE) for new and DISP=(OLD,KEEP,KEEEP) for existing datasets.
  • If the DISP parameter is ignored, the default is a NEW dataset with a disposition of DELETE for normal and abnormal termination dispositions. i.e., DISP=(NEW,DELETE,DELETE).
Note! The DISP parameter can’t be ignored for a dataset that is created and deleted in a single step.

Examples -


Scenario - Create new PS file.

//STEP10   EXEC PGM=IEFBR14
//DD1      DD DSN=MATEPK.IEFBR14.PSFILE,
//            DISP=(NEW,CATLG,DELETE),
//            SPACE=(TRK,(3,2),RLSE),
//            UNIT=SYSDA,VOLUME=SER=DEVHD4,
//            DCB=(DSORG=PS,RECFM=FB,LRECL=80,BLKSIZE=800)

The statements request the system to CATLOG the new dataset if the step terminates normally and DELETE the dataset if the step terminates abnormally.