Understanding the DD Statement

Understanding the DD Statement

The DD (Data Definition) Statement defines the datasets used in the job. It links the program to the resources it needs, such as input files or temporary storage.

Syntax

//DDNAME DD DSN=data-set-name,DISP=disposition[,parameters]

Parameters

  1. DDNAME: The name used within the program to reference the dataset.

  2. DSN: The name of the dataset.

  3. DISP: Specifies how the dataset is handle.

    • SHR: Opens an existing dataset for shared access.

    • NEW: Creates a new dataset.

    • OLD: Indicates that the dataset already exists and will be overwritten during the job step. Additionally, no other job will have access to this dataset until the current job step is complete.

    • MOD: Specifies that the dataset already exists and allows new records to be appended to it, without overwriting the existing records.

    • CATLG: The dataset is retained with an entry in the system catalog

    • UNCATLG: Dataset is deleted from user and system catalog

    • DELETE: dataset is deleted from user and system catalog

    • PASS:Used for only normal end this is used when the dataset is to be passed and processed by the next job step in a jcl

  4. DCB(Data Control Block):

    • LRECL: Record length of the dataset

    • RECFM: Record format of the dataset such as FB(Fixed Block) or VB(Variable Block)

    • BLKSIZE: Block size of the dataset

    • DSORG: Dataset organization

    • SPACE: Specifies the space required for the dataset,

    • RLSE: Releases unused allocated space.

    • UNIT: Specifies what type of storage to use for the dataset. DASD(Direct Access Storage Device) or SYSDA

    • SYSOUT: Directs output to a specific location, such as the spool or printer.

    • SYSOUT=*: Sends output to the default spool

    • SYSOUT=X: Sends output to a specific output class

Example

//MYFILE DD DSN=MY.DATASET.NAME,

// DISP=(NEW,CATLG,DELETE),

// SPACE=(CYL,(10,5),RLSE),

// UNIT=SYSDA,

// DCB=(RECFM=FB,LRECL=80,BLKSIZE=800,DSORG=PO)

Explanation:

  1. DSN=MY.DATASET.NAME: Specifies the name of the dataset.

  2. DISP=(NEW, CATLG,DELETE): Creates a new dataset, catalogs it on success, and deletes it on failure.

  3. SPACE=(CYL,(10,5),RLSE): Allocates 10 cylinders initially, with 5 more as needed, and releases unused space.

  4. UNIT=SYSDA: Uses the default system storage device.

  5. DCB=(RECFM=FB,LRECL=80, BLKSIZE=800,DSORG=PO):

    • Records are fixed length.

    • Each record is 80 bytes long.

    • Each block contains 800 bytes of data.

    • DSORG=PO: Specifies a partitioned dataset (PDS).

Last updated