DD LIKE parameter


Note! LIKE parameter is required only when we are creating a dataset.

The LIKE parameter allows you to create a new dataset with the attributes of an existing (model) dataset. LIKE is an optional parameter.

The model dataset should be cataloged and should exist in disk volume. The below list of attributes can be copied from the model dataset to the new dataset -

  • Dataset organization (RECORG) or(RECFM).
  • Record length (LRECL).
  • Key length (KEYLEN).
  • Key offset (KEYOFF).
  • Type (DSNTYPE).
  • Space allocation (AVGREC and SPACE).

The retention period (RETPD) or expiration date (EXPDT) is not copied to the new dataset.

Note: - Temporary dataset (&&dsname) attributes can’t be copied by using LIKE parameter.

Syntax -

LIKE=old-dataset-name
old-dataset-name Specifies the model dataset full name.

Default and overrides -

Any attributes coded on the same DD statement override the related attributes obtained from the model dataset.

Examples -


Scenario - Creating a new dataset with the attributes of an existing dataset

//INPUT    DD DSN=MTH.OLD.DATASET,DISP=SHR
//OUTPUT   DD DSN=MTH.NEW.DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            LIKE=INPUT