DD is the short form of ‘Data Definition’. All the datasets which we are using in the steps, we define in ‘DD’ statement. The DD statement does not exist by itself and it codes under an ‘EXEC’ statement.
Base on the requirement of the steps, one EXEC statement can have multiple DD statements under it.
- We have to code a separate DD statement for each datasets which are used in the step.
- The details of dataset like – Physical name of a dataset, Status of dataset, space parameters, unit, volume, type of dataset, the record format of a dataset, logical record length, block size etc are coded in DD statement.
- If you want to print output related messages to SPOOL or a particular class, you can code ‘SYSPRINT’ or ‘SYSOUT’ DD statements.
- If we want to print the dumps in the spool area or to a particular class, then you can use ‘SYSDUMP’ DD statements.
- We can pass data to the program using ‘SYSIN’ DD statement.
- We can use ‘SYSUT1’ and ‘SYSUT2’ to provide input and output file respectively in some utilities.
Example 1 of DD statement
We use this DD statement to create a dataset with a name – ‘MATEKS.TEST.PS.FILE2’.
‘DISP’ parameter provides the current status, normal disposition, and abnormal disposition. It also provides the space-related details, unit and DCB parameters. We use the data control block(DCB) parameter of the DD statement to define the type of dataset, record format, logical record length, and block size.
Example 2 of DD statement
We use DD statement to provide the physical dataset name which is ‘MATEKS.TEST.DATA’. The status of the dataset is also provided in this case i.e. DISP=SHR means that the file will be used in ‘Shared’ mode.
Example 3 of DD statement
To print the output messages in SPOOL we use this DD statement.
Example 4 of DD statement
To print the output messages in Class ‘A’ we use this DD statement.
Example 5 of DD statement
To display the output messages in SPOOL we use this DD statement.
Example 6 of DD statement
This DD statement will alter the properties of the dataset ‘MATEKS.SALES.WEEK‘ with Limit as 2 with NOEMPTY and SCRATCH.
You will master about NOEMPTY, SCRATCH, LIMIT etc as you move further.
Example 7 of DD statement
This DD statement is used to provide the dumps of the JCL.
Dumps can be of many types like system related dumps or user dumps. Here, it will be user dumps.
JCL Interview Question and Answers
You will not know the answers of all these questions but you will learn about these once you complete the tutorials.
1. Consider the following JCL,
//TESTPROC PROC B=ABLE,C=3330,D=WXYZ1, E=OLD,F=TRK,G='10,10,1' //STEP EXEC PGM= IEFBR14 //DD1 DD DSNAME=&B,UNIT=&C,VOLUME=SER=&D,DISP=&E, // SPACE=(&F,(&G)) // PEND Job: //CALLER2 EXEC PROC=TESTPROC,B=,C=3350,D=,E= After symbolic substitution, the statements in the procedure will look like:
a) //DD1 DD DSNAME=ABLE,UNIT=3330,VOLUME=SER=WXYZ1,DISP=OLD,SPACE=(TRK,(10,10,1))
b) //DD1 DD DSNAME=ABLE, UNIT=3350,VOLUME=SER=,DISP=,SPACE=(TRK,(10,10,1))
c) //DD1 DD DSNAME=,UNIT=3350,VOLUME=SER=,DISP=,SPACE=(TRK,(10,10,1))
d) //DD1 DD DSNAME=,UNIT=3350,VOLUME=SER= WXYZ1,DISP=,SPACE=(TRK,(10,10,1))
3. Consider the following code,
//SETB SET AA=BETA.PGM.RATE,BB=DCLAS03, // CC=NEW //PR3 PROC ... //S3 EXEC PGM=... //DD7 DD DSNAME=&AA,DATACLAS=&BB,DISP=&CC // PEND //S1 EXEC PROC=PR3,BB=DCLAS0X,CC=SHR The values that will be assigned for DD7 are,
a. //DD7 DD DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS03,DISP=NEW
b. //DD7 DD DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS0X,DISP=NEW
c. //DD7 DD DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS0X,DISP=SHR
d. //DD7 DD DSNAME=BETA.PGM.RATE,DATACLAS=DCLAS03,DISP=SHR
5. DD in the PROC can be overwritten in the main JCL is done by a Linkage Variable
b. //PROCStepname.ddname dd dsn=