Data Definition (DD) Statement
A Data Definition (DD) statement is a fundamental Job Control Language (JCL) statement used in IBM z/OS to define and allocate input/output resources for a job step. It associates a symbolic name (DDNAME) with a specific physical dataset, device, or other I/O resource, enabling programs to access data without needing to know the physical characteristics of the resource.
Key Characteristics
-
- Syntax: A DD statement begins with
//ddname DDfollowed by various parameters that describe the resource. Theddnameis a symbolic name (1-8 characters) referenced by the application program. - Resource Allocation: It specifies the type of I/O resource (e.g., sequential dataset, VSAM dataset, PDS/PDSE member, tape volume, printer, terminal) and its attributes.
- Scope: DD statements are typically defined within a specific job step (
EXECstatement) and are active only for the duration of that step. They can also be defined at the job level (JOBstatement) for global scope. - Parameters: Common parameters include
DSN(dataset name),DISP(disposition),UNIT(device type),VOL(volume serial),SPACE(allocation for new datasets),DCB(data control block attributes),SYSOUT(spooled output),PATH(for z/OS UNIX files), andINSTREAM(for inline data). - Dynamic Allocation: While traditionally defined in JCL, resources can also be dynamically allocated by programs using SVC 99 or
TSO ALLOCATEcommands, which effectively create DD statements in memory.
- Syntax: A DD statement begins with
Use Cases
-
- Program Input/Output: Defining input files for a COBOL program (e.g.,
//INFILE DD DSN=PROD.INPUT.DATA,DISP=SHR) and output files (e.g.,//OUTFILE DD DSN=PROD.OUTPUT.REPORT,DISP=(NEW,CATLG,DELETE),SPACE=(CYL,(10,5))). - Temporary Work Files: Allocating temporary datasets for intermediate processing within a job step using
DSN=&&TEMPDSNorDSN=&SYSUT1(for utilities). - Spooling Output: Directing program output to the system spool for printing or viewing using
SYSOUT=*orSYSOUT=(A,INTRDR). - Utility Program Resources: Specifying input and output datasets for z/OS utility programs like IEBGENER, IDCAMS, or DFSORT.
- In-stream Data: Providing small amounts of input data directly within the JCL stream using
DD *orDD DATA.
- Program Input/Output: Defining input files for a COBOL program (e.g.,
Related Concepts
DD statements are integral to JCL (Job Control Language), serving as the primary mechanism to bridge application programs with external data resources. A COBOL program's SELECT...ASSIGN TO ddname clause directly refers to a DD statement's ddname, allowing the program to perform I/O operations without knowing the physical dataset details. The z/OS operating system uses the information in DD statements to allocate physical devices and datasets, manage access, and enforce security. They work in conjunction with datasets (sequential, PDS/PDSE, VSAM) and catalogs (VSAM, ICF) by providing the dataset name, which the system then uses to locate the dataset's attributes and physical location.
- Meaningful DDNAMEs: Use descriptive
ddnames that clearly indicate the purpose of the dataset (e.g.,INFILE,OUTRPT,SYSPRINT). - Cataloged Datasets: For permanent datasets, always catalog them (
DISP=(NEW,CATLG)) and omitUNITandVOLparameters in subsequentDDstatements to allow the system to locate them efficiently. - Temporary Datasets: Use
DSN=&&TEMPDSNfor temporary datasets that are deleted at job end, orDSN=&SYSUT1for standard utility work files. - Disposition (
DISP): Carefully specifyDISPparameters (e.g.,(NEW,CATLG,DELETE),(OLD,KEEP),(MOD,PASS)) to ensure correct dataset creation, retention, and sharing, preventing data loss or integrity issues. FREE=CLOSE: For datasets that might be shared or need to be released before the step ends (e.g., tape drives, specific DASD volumes), useFREE=CLOSEto deallocate the resource immediately after the dataset is closed by the program.