Examples of the DISP parameter

Example 1
//DD2  DD  DSNAME=FIX,UNIT=3420-1,VOLUME=SER=44889,
//         DISP=(OLD,,DELETE)

DD statement DD2 defines an existing data set and implies by the omitted second subparameter that the data set is to be kept if the step terminates normally. The statement requests that the system delete the data set if the step terminates abnormally.

Example 2
//STEPA  EXEC PGM=FILL
//DD1    DD   DSNAME=SWITCH.LEVEL18.GROUP12,UNIT=3390,
//        VOLUME=SER=LOCAT3,SPACE=(TRK,(80,15)),DISP=(,PASS)
//STEPB  EXEC PGM=CHAR
//DD2    DD   DSNAME=XTRA,DISP=OLD
//DD3    DD   DSNAME=*.STEPA.DD1,DISP=(OLD,PASS,DELETE)
//STEPC  EXEC PGM=TERM
//DD4    DD   DSNAME=*.STEPB.DD3,DISP=(OLD,CATLG,DELETE)

DD statement DD1 defines a new data set and requests that the data set be passed. If STEPA abnormally terminates, the data set is deleted because it is a new data set, the second subparameter is PASS, and an abnormal termination disposition is not coded.

DD statement DD3 in STEPB receives this passed data set and requests that the data set be passed. If STEPB abnormally terminates, the data set is deleted because of the third subparameter of DELETE.

DD statement DD4 in STEPC receives the passed data set and requests that the data set be cataloged at the end of the step. If STEPC abnormally terminates, the data set is deleted because of the abnormal termination disposition of DELETE.

DD statement DD2 defines an old data set named XTRA. When STEPB terminates, normally or abnormally, this data set is kept.

Example 3
//SMSDD5 DD  DSNAME=MYDS5.PGM,DATACLAS=DCLAS05,STORCLAS=SCLAS05,
//          DISP=(NEW,KEEP)

DD statement SMSDD5 defines a new SMS-managed data set and requests that the data set be kept (which implies that it be cataloged).

Example 4
//SMSDD7 DD  DSNAME=MYDS7.PGM,DISP=(OLD,UNCATLG)

DD statement SMSDD7 defines an existing SMS-managed data set (the data set had been assigned a storage class when it was created) and requests that the data set be uncataloged. However, the data set is kept because UNCATLG is ignored for SMS-managed data sets.