codegurukool.com · Free coding tutorials & online compiler

Home › Mainframe Tutorial › DD statements and DISP

DD statements and DISP

Control how a dataset is used.

The DSN parameter names a dataset and DISP says what happens to it: its status (NEW, OLD, SHR), what to do when the step ends normally and what to do if it fails. Names that start with && are temporary datasets.

Example code

//DDJOB JOB (ACCT),'DD',CLASS=A,MSGCLASS=X
//STEP1    EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//SYSUT1   DD *
TEMPORARY DATA
/*
//SYSUT2   DD DSN=&&TEMP,DISP=(NEW,PASS),SPACE=(TRK,(1,1)),
//            RECFM=FB,LRECL=80
//STEP2    EXEC PGM=IEBGENER
//SYSPRINT DD SYSOUT=*
//SYSIN    DD DUMMY
//SYSUT1   DD DSN=&&TEMP,DISP=(OLD,DELETE)
//SYSUT2   DD SYSOUT=*

Run this code in the online editor

← JCL basics: JOB, EXEC and DDDFSORT utility →