LIKE Parameter Example


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

Code -

----+----1----+----2----+----3----+----4----+----5----+
//INPUT    DD DSN=MTH.OLD.DATASET,DISP=SHR
//OUTPUT   DD DSN=MTH.NEW.DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            LIKE=INPUT

Scenario2 - Creating a new dataset with the attributes of an existing dataset except DSNTYPE parameter.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//INPUT    DD DSN=MTH.OLD.DATASET,DISP=SHR
//OUTPUT   DD DSN=MTH.NEW.DATASET,
//            DISP=(NEW,CATLG,DELETE),
//            LIKE=INPUT,
//            DSNTYPE=LIBRARY