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.
//DDname DD DSN=&&temp-data-set-name,...
Scenario 1 - 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)
Scenario 2 - Defining a temporary PDS member with LRECL of 80 bytes
//NEWPS DD DSN=&&TEMPPDS(MEMBER), // DISP=(NEW,PASS,), // UNIT=SYSDA, // SPACE=(TRK,(3,2,2),RLSE), // DCB=(DSORD=PO,RECFM=FB,LRECL=80,BLKSIZE=800)