Temporary Datasets
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 -
Scenario - Defining an temporary PS file with LRECL of 500 bytes
//NEWPS DD DSN=&&TEMPPS,
// DISP=(NEW,PASS,),
// UNIT=SYSDA,
// SPACE=(TRK,(3,2),RLSE),
// DCB=(DSORD=PS,RECFM=FB,LRECL=500,BLKSIZE=5000)