Skip to main content

DISP for new and existing dataset.

Sample Job to try

//<YOUR ID>J  JOB ,NOTIFY=&SYSUID
//OUTPUT1 EXEC PGM=IEFBR14
//SYSPRINT DD SYSOUT=*
//DD1 DD DSN=&SYSUID..EXERDIST.OUTPUT1,
// SPACE=(CYL,(2,2)),DCB=(RECFM=FB,LRECL=80,BLKSIZE=800),
// <GIVE YOU DISP HERE>

Try Following DISP for the new as well as existing Dataset in the above JCL and note down your observations. For new Dataset make sure to delete dataset or use different name.

  • NO DISPOSITION
  • (Only Status)
    • DISP=NEW, DISP=OLD, DISP=SHR, DISP=MOD
  • (Status and Normal)
    • DISP=NEW,KEEP DISP=OLD,KEEP, DISP=SHR,KEEP
    • DISP=NEW,CATLG DISP=OLD,CATLG
    • DISP=NEW,UNCATLG DISP=MOD,UNCATLG

Exercise: Disposition for Temporary dataset.

  • Create a temporary dataset in STEP1, write something into it, and use it in STEP2. Ensure it's deleted after STEP2.

  • Create a temporary dataset in STEP1 that is not used by any other step and should be auto-deleted.

  • Create a TEMP dataset in STEP1, use it in STEP2, but it should not be available in STEP3.

  • Create a temporary dataset and try to KEEP it. What happens?

  • Create a temporary dataset in STEP1, and try to create another temp dataset with the same name in STEP2. What happens?

Exercise: Create DD statement for following DISP Scenarios

  • Create new dataset, delete it after it used.

  • Create a new dataset; keep it without cataloging on success; delete on failure.

  • Create a new dataset in Step1, catalog it if successful, delete if failed. Step2 appends to this dataset.

  • Use an existing dataset exclusively, keep it regardless of outcome.

  • Append to a dataset if it exists; create it if not; keep dataset regardless of step success or failure.

  • Create a temporary dataset in Step1, passed to Step2, deleted after Step2 completes normally or abnormally.

  • Use an existing dataset for read-only access across multiple steps without locking conflicts.

  • Dataset created in Step1 is kept but not cataloged; Step2 deletes it.