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 is cataloged).
Example 4
//SMSDD7 DD  DSNAME=MYDS7.PGM,DISP=(OLD,UNCATLG)
DD statement SMSDD7 defines an existing SMS-managed data set (the data set is assigned a storage class when it is created) and requests that the data set be uncatalogued. However, the data set is kept because UNCATLG is ignored for SMS-managed data sets.

Start of changeExample 5End of change

Start of change
//STEPB EXEC PGM=FAILURE,ABDISPCC=(16,GE)
//DD2   DD DSN=TEST.DSN,DISP=(NEW,CATLG,DELETE),
//         UNIT=SYSALLDA,VOLUME=SER=DASD01,
//         SPACE=(TRK,1)
DD statement DD2 defines a new data set. If STEPB terminates normally with a step completion code less than 16, the data set is cataloged. If STEPB abnormally terminates, or normally terminates with a step completion code greater than or equal to 16, the data set is deleted.End of change
Start of changeExample 6
//STEP1   EXEC PGM=PROG1                                  
//DD1     DD  DSN=&&TEMP01,
//            UNIT=SYSALLDA,VOL=SER=MYDASD,  
//            SPACE=(TRK,1),                              
//            DISP=(NEW,PASS,DELETE)                    
//STEP2   EXEC PGM=PROG2,COND=EVEN                        
//DD2     DD  DSN=&&TEMP01,DISP=(OLD,DELETE)
DD statement DD1 defines a new temporary data set and requests that the data set be passed. When STEP1 terminates, normally or abnormally, the data set will be passed. Because this data set is a temporary data set, the abnormal termination disposition specified in the third subparameter of the DISP parameter will be ignored and the data set will be processed according to the normal termination disposition.End of change

Start of changeSTEP2 will be executed, even if STEP1 abnormally terminates, because of the specification of the COND parameter. This step receives the data set from STEP1. When STEP2 terminates, normally or abnormally, the data set will be deleted.End of change