Let's understand Mainframe
Home Tutorials Interview Q&A Quiz Mainframe Memes Contact us About us

Module 4: JCL DD Statement


DD Statement

Most of the time, purpose of writing a Job is data processing, For data processing, program takes some data in form of input, perform required operation on it and then passes it to some kind of output files. In mainframe, files are called as Dataset, and statement that which can be used to define dataset in Job is called as DD Statement. DD stands for Data Definition.

DD statement is coded for every file used in program unless the file is dynamically allocated by the program. The name coded for the DD will be referred in the program as file name while physical attributes are coded in the JCL

Few important DD statement Rules:

  • DD statement must have valid name (explained in next section) and it should be unique in the specific step, however we can code same DD name across multiple job steps.
  • The name coded for the DD will be referred in the program as file name while physical attributes are coded in the JCL
  • DD statement must be next to EXEC statement
  • A DD statement must be coded for each dataset used, which means you can’t code multiple datasets in single DD statement
  • Maximum 3273 DD statements can be coded per Job step

DD Statement – Syntax
 
Syntax:

//DDNAME DD <positional/keyword parms> [comments]

Where,

DDNAME:- It is name assigned to the job step. It must be 1 to 8 alphanumeric (A-Z, 0-9) or national character (@, $, #). Make sure the first character must be coded alphabetic or national. DDNAME should be unique in the specific step, however we can code same DD name across multiple job steps.

Few DDNAMES are system-reserved and thus cannot be used to define DD statement:-

//JOBLIB //JOBCAT //SYSABEND //STEPCAT
//SYSIN //SYSDBOUT //SYSCHK //STEPLIB
//SYSOUD //SYSDUMP //SYSOUT

DD:- It is keyword, used to indicate that the statement is DD statement

positional/keyword parms:- We can code positional and keyword parameters. These are explained below in more details

comments:- This filed can be used to write note for statement. This filed should be preceded with blank character after coding parameter filed. This must be avoided if parameter field is blank

HOW TO REFER DDNAME IN PROGRAMS?

Before we start explaining Positional/Keyword parameters in details, let’s with example how DD Statement coded for Dataset in JCL can be referred in programs


Example:-

//DEPTFILE DD DSN=PAYP.DEPT.DETAILS,DISP=SHR

In below way, program can refer this file with name DEPTFILE

COBOL PRGRAM:- SELECT file1 ASSIGN TO DEPTFILE

ASSEMBLER:- DCB DDNAME = DEPTNAME


KEYWORD PARAMETERS

There are many keyword parameters that can be coded in DD statement, the following are most commonly used:-

  • DSN
  • DISP
  • DCB
  • UNIT
  • VOLUME
  • SPACE
  • SYSOUT

Each of them are described in detail in upcoming articles






© copyright mainframebug.com
Privacy Policy