DD Statement

Purpose

The DD (Data Definition) statement identifies and describes a data set to be used in a job step. It connects a program's logical file references to physical data sets and specifies their attributes.

Syntax

jcl
1
//ddname DD parameter[,parameter]...

Key Parameters

  • ddname - A 1-8 character name that identifies the data definition. Must begin with an alphabetic (A-Z) or national (@, #, $) character.
  • DSN=dataset.name or DSNAME=dataset.name - Specifies the name of the data set
  • DISP=(status,normal-termination,abnormal-termination) - Specifies data set disposition

Common Parameters

  • UNIT=device-type - Specifies the device type for the data set
  • VOL=SER=volume-serial - Specifies the volume where the data set resides
  • SPACE=(unit,(primary,secondary,directory)) - Allocates space for new data sets
  • DCB=(attribute=value,...) - Defines data set characteristics
  • SYSOUT=class - Directs output to a specific output class
  • * - Indicates in-stream data follows (terminated by /*)
  • DUMMY - Creates a dummy data set (no I/O operations performed)

Examples

Existing Data Set

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

Creating a New Data Set

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

System Output

jcl
1
//REPORT DD SYSOUT=A

In-stream Data

jcl
1
2
3
4
//SYSIN DD * data record 1 data record 2 /*

Dummy Data Set

jcl
1
//DUMMY DD DUMMY

Concatenated Data Sets

jcl
1
2
//INPUT DD DSN=USER.DATA1,DISP=SHR // DD DSN=USER.DATA2,DISP=SHR

DISP Parameter Values

  • Status: NEW, OLD, SHR, MOD
  • Normal termination: CATLG, KEEP, DELETE, PASS, UNCATLG
  • Abnormal termination: CATLG, KEEP, DELETE, UNCATLG

Notes

  • DD statements must follow an EXEC statement
  • The ddname must match the file name referenced in the program
  • Special ddnames like JOBLIB, STEPLIB, SYSUDUMP have specific meanings
  • DISP=SHR allows multiple jobs to read a data set simultaneously
  • DCB parameters can be inherited from data set labels or overridden

Related Concepts

  • Data Set Organization (DSORG) - PS, PO, VSAM, etc.
  • Record Formats (RECFM) - F, FB, V, VB, U
  • Generation Data Groups (GDG) - Versioned data sets
  • Temporary Data Sets - Deleted at end of job
  • VIO (Virtual I/O) - Data sets in memory