Temporary Datasets

Temporary datasets are created and used during the execution of a job. These datasets are temporary and deleted at the end of the job (not at the end of the step). These datasets are typically used for intermediate processing, such as sorting, merging, or other transformations.

Temporary datasets are defined using the DD statement with a special naming convention. The naming convention for temporary datasets typically begins with an ampersand (&&) followed by a unique name. For example, &&TEMP might be used as the name for a temporary dataset used during sorting.

Syntax -

//DDname DD DSN=&&temp-data-set-name,...

Examples -

Scenario1 - Defining an temporary PS file with LRECL of 500 bytes

//            DISP=(NEW,PASS,),
//            UNIT=SYSDA,
//            SPACE=(TRK,(3,2),RLSE),
//            DCB=(DSORD=PS,RECFM=FB,LRECL=500,BLKSIZE=5000)

Scenario2 - Defining a temporary PDS member with LRECL of 80 bytes

//            DISP=(NEW,PASS,),
//            UNIT=SYSDA,
//            SPACE=(TRK,(3,2,2),RLSE),
//            DCB=(DSORD=PO,RECFM=FB,LRECL=80,BLKSIZE=800)