DISP Parameter

Purpose

The DISP (disposition) parameter specifies the status of a data set when a job step begins processing, and determines what happens to the data set when the step ends normally or abnormally. This parameter is crucial for controlling data set availability, sharing, and retention throughout the job's execution.

Syntax

Basic Format

jcl
1
//ddname DD DSN=dataset.name,DISP=(status,normal-disp,abnormal-disp)

Simplified Formats

jcl
1
2
3
//ddname DD DSN=dataset.name,DISP=status //ddname DD DSN=dataset.name,DISP=(status,normal-disp) //ddname DD DSN=dataset.name,DISP=(,,abnormal-disp)

Parameter Values

Status Subparameter

ValueDescription
NEWCreate a new data set. The system allocates space for the data set on a direct access volume.
OLDThe data set exists and is exclusively allocated to this job step (no sharing).
SHRThe data set exists and can be shared with other jobs (read sharing).
MODIf the data set exists, position at the end for addition of records.
If the data set does not exist, create it (like NEW).

Normal Termination Disposition

ValueDescription
DELETERemove the data set from the system.
KEEPRetain the data set on the volume, but don't catalog it.
PASSMake the data set available to subsequent steps in the job.
CATLGRetain the data set and record its location in the catalog.
UNCATLGRetain the data set but remove its catalog entry.

Abnormal Termination Disposition

Same values as normal termination disposition: DELETE, KEEP, CATLG, UNCATLG. Note that PASS is not valid for abnormal termination.

Default Values

StatusDefault Normal DispositionDefault Abnormal Disposition
NEWDELETEDELETE
OLDKEEPKEEP
SHRKEEPKEEP
MODKEEP (if exists), DELETE (if new)KEEP (if exists), DELETE (if new)

Examples

Creating a New Data Set

jcl
1
2
3
4
//OUTFILE DD DSN=USER.NEW.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)

Creates a new data set; catalogs it if step ends normally; deletes it if step abnormally terminates

Accessing an Existing Data Set

jcl
1
//INFILE DD DSN=SYS1.PAYROLL.DATA,DISP=SHR

Accesses an existing data set with shared access; keeps it after step ends (default)

Modifying an Existing Data Set

jcl
1
//UPDATE DD DSN=PROD.MASTER.DATA,DISP=(OLD,KEEP)

Accesses an existing data set with exclusive access; keeps it after normal completion

Appending to an Existing Data Set

jcl
1
//APPEND DD DSN=PROD.LOG.DATA,DISP=(MOD,CATLG,KEEP)

Appends to existing data set or creates it if not found; catalogs after normal completion

Temporary Data Set (Passed Between Steps)

jcl
1
2
3
4
//STEP1 EXEC PGM=SORT //SORTWK1 DD DSN=&&TEMP1,DISP=(NEW,PASS),SPACE=(CYL,5) //STEP2 EXEC PGM=REPORT //INFILE DD DSN=&&TEMP1,DISP=(OLD,DELETE)

Creates temporary data set in STEP1, passes it to STEP2, then deletes it

Protection for Existing Data

jcl
1
//MASTER DD DSN=PROD.CRITICAL.DATA,DISP=(SHR,,KEEP)

Uses SHR status but explicitly ensures data is kept even if job fails

Generation Data Group (GDG)

jcl
1
2
3
4
//GDGOUT DD DSN=ACCT.MONTH.DATA(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10)), // DCB=(RECFM=FB,LRECL=200,BLKSIZE=27800)

Creates a new generation in a GDG; catalogs it if successful

Common Disposition Patterns

PatternUse CaseExample
DISP=(NEW,CATLG,DELETE)Standard pattern for creating permanent data setsCreation of output files from a job
DISP=(NEW,PASS,DELETE)Creating temporary data sets passed between stepsWorking files in multi-step jobs
DISP=(NEW,DELETE)Creating truly temporary data setsSort work files, intermediate results
DISP=SHRReading shared data setsReference data, lookups, inputs
DISP=(OLD,KEEP)Updating existing data setsMaster files, transaction processing
DISP=(MOD,CATLG,KEEP)Append to existing data setsLog files, cumulative reports
DISP=(OLD,UNCATLG)Remove catalog entries but keep dataArchive processes

DISP Processing Rules

  1. Status Determination: At the beginning of a step, the system processes the status subparameter to determine how to handle the data set
  2. NEW Processing: For NEW data sets, the system allocates space and creates a system-generated name if DSN is not specified
  3. MOD Processing: For MOD, if the data set exists, the read/write pointer is positioned at the end; if not, it is treated as NEW
  4. OLD/SHR Verification: For OLD or SHR, if the data set does not exist, the step fails unless it's a dummy data set
  5. Normal Termination: If the step ends normally (without errors), the normal disposition is processed
  6. Abnormal Termination: If the step fails, the abnormal disposition is processed (or the default if not specified)
  7. PASS Behavior: Data sets with PASS remain allocated until the job ends or a subsequent step specifies a different disposition
  8. Temporary Data Sets: Data sets with DSN=&&name are automatically deleted at the end of the job, regardless of disposition
  9. Step Failures: If allocation fails due to DISP processing, the step and potentially the job will fail

Data Set Sharing

Access Compatibility Matrix

If one job usesAnother job can useAnother job cannot use
DISP=SHR (read-only)DISP=SHR (read-only)DISP=OLD, DISP=(NEW), DISP=(MOD)
DISP=OLD (exclusive)NoneDISP=SHR, DISP=OLD, DISP=(NEW), DISP=(MOD)
DISP=(NEW) (new allocation)NoneDISP=SHR, DISP=OLD, DISP=(NEW), DISP=(MOD)
DISP=(MOD) (append)NoneDISP=SHR, DISP=OLD, DISP=(NEW), DISP=(MOD)

Enhanced Sharing Options

In addition to basic DISP sharing, enhanced data set sharing can be accomplished using:

  • DISP=SHR with ENQ macros: Programs can use ENQ/DEQ to control record-level access
  • VSAM SHAREOPTIONS: Control read/write sharing for VSAM data sets
  • Global Resource Serialization (GRS): System-level control of resource sharing
  • DSENQSHR Parameter: Control how data set enqueues are shared between jobs

Use Cases

Data Management Workflows

  • Creating new permanent data sets for regular processing
  • Ensuring critical datasets are kept even if jobs fail
  • Setting up data flow between job steps with passed datasets
  • Managing temporary work files without permanent storage

Production Environments

  • Ensuring exclusive access to master files during updates
  • Allowing multiple jobs to read reference data concurrently
  • Creating new generations of historical data
  • Protecting production data with appropriate abnormal termination dispositions

Backup and Recovery

  • Creating backup copies with DISP=(NEW,CATLG,DELETE)
  • Preventing accidental deletion with DISP=(OLD,,KEEP)
  • Managing archive processes with DISP=(OLD,UNCATLG)
  • Ensuring data is properly cataloged for disaster recovery

Development and Testing

  • Creating test datasets that automatically delete when done
  • Sharing test reference data between multiple developers
  • Ensuring test runs don't affect production catalogs
  • Using temporary datasets for test data generation

Limitations

  • PASS scope: Data sets with PASS disposition are only available within the same job, not across jobs
  • GDG restrictions: Special rules apply for GDG data sets and their dispositions
  • SMS-managed data sets: Some disposition combinations may be overridden by SMS management classes
  • CATLG failures: If a data set cannot be cataloged (e.g., duplicate name), the system attempts KEEP instead
  • DELETE protection: Some data sets may be protected against deletion by security settings
  • Temporary data set naming: When using &&name, the system creates unique names but this requires coordination when passing between steps
  • DISP=(MOD) behavior: For non-VSAM data sets, MOD positions at the end, but for VSAM, the behavior depends on the data set type

Common Mistakes

  • Using SHR for updates: Multiple jobs trying to update with DISP=SHR
    jcl
    1
    //BAD DD DSN=MASTER.DATA,DISP=SHR // Wrong if updating the file!
  • Missing abnormal disposition: Not specifying what happens if a step fails
    jcl
    1
    //RISKY DD DSN=CRITICAL.DATA,DISP=(NEW,CATLG) // What if step fails?
  • Using DELETE for input files: Accidentally removing input data sets
    jcl
    1
    //INPUT DD DSN=SOURCE.DATA,DISP=(SHR,DELETE) // Will delete after step!
  • Using PASS for the last step: Data sets may not be properly handled
    jcl
    1
    2
    //LASTSTEP EXEC PGM=FINAL //OUTPUT DD DSN=RESULT.DATA,DISP=(NEW,PASS) // Not passed to anyone!
  • Forgetting MOD behavior: Not anticipating that MOD will create a new file if one doesn't exist
    jcl
    1
    //APPEND DD DSN=LOG.FILE,DISP=(MOD,KEEP) // Creates new file if missing
  • Inconsistent dispositions: Using conflicting dispositions between job steps
    jcl
    1
    2
    //STEP1 DD DSN=TEST.DATA,DISP=(NEW,DELETE) // Deleted after STEP1 //STEP2 DD DSN=TEST.DATA,DISP=OLD // Will fail - file was deleted!

Best Practices

  • Always specify abnormal disposition: Ensure data sets are handled properly even if a job fails
  • Use SHR for read-only access: When possible, use SHR to maximize concurrent processing
  • Use OLD for updates: Always use OLD when modifying existing data sets
  • Default to CATLG for NEW: Generally use DISP=(NEW,CATLG,DELETE) for new permanent data sets
  • Use DELETE appropriately: Only specify DELETE for truly temporary data or when the data should not be retained after a failure
  • Plan for abnormal termination: Always consider what should happen to data sets if a job fails
  • Be cautious with MOD: Remember that MOD creates a new data set if one doesn't exist
  • Temporary data set management: Use &&name and DISP=(NEW,PASS) for data shared between steps
  • Document special dispositions: If using unusual disposition combinations, document the reason
  • Use consistent patterns: Adopt standard disposition patterns across your organization

Related Concepts

Related Pages