DSN Parameter

Purpose

The DSN (or DSNAME) parameter specifies the name of a data set that a job step is creating or accessing. It identifies the specific data set to be allocated or processed by the program. The DSN parameter is one of the most fundamental parameters on the DD statement, as it establishes the connection between a program and the data it needs to process.

Syntax

Basic Syntax

jcl
1
2
//ddname DD DSN=dataset.name,other-parameters //ddname DD DSNAME=dataset.name,other-parameters

Temporary Data Set

jcl
1
//ddname DD DSN=&&tempname,other-parameters

Member of a Partitioned Data Set

jcl
1
//ddname DD DSN=dataset.name(member),other-parameters

Generation Data Group

jcl
1
2
3
//ddname DD DSN=gdg.name(+1),other-parameters //ddname DD DSN=gdg.name(0),other-parameters //ddname DD DSN=gdg.name(-1),other-parameters

Format

Data Set Name Rules

  • Length: 1-44 characters (including periods)
  • Qualifiers: 1-8 characters separated by periods
  • Valid characters: Alphanumeric (A-Z, 0-9), national characters (@, #, $), hyphen (-)
  • First character: Alphabetic (A-Z) or national character (@, #, $)
  • Qualifier structure: dataset.name.qualifier1.qualifier2...
  • Maximum qualifiers: Usually 22 (with 21 periods)

Special Format Variations

FormatDescriptionExample
StandardNormal data set nameDSN=SYS1.PROCLIB
TemporaryTemporary data set with double ampersandsDSN=&&TEMP
MemberMember of a partitioned data set (PDS)DSN=SYS1.PROCLIB(IEFBR14)
GDGGeneration Data Group with relative generation numberDSN=ACCT.MASTER(+1)
ConcatenationMultiple data sets combined (no DSN on continuation)Multiple DD statements without ddnames
ReferbackReference to previous DSNDSN=*.stepname.ddname

Examples

Basic Data Set Reference

jcl
1
//INFILE DD DSN=SYS1.PAYROLL.DATA,DISP=SHR

Refers to the cataloged data set SYS1.PAYROLL.DATA

Creating a New Data Set

jcl
1
2
3
4
//OUTFILE DD DSN=USER.NEW.DATASET, // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=27920)

Creates a new data set USER.NEW.DATASET with the specified attributes

Temporary Data Set

jcl
1
2
3
4
//TEMPFILE DD DSN=&&TEMPDS, // DISP=(NEW,DELETE), // SPACE=(TRK,(5,1)), // DCB=(RECFM=FB,LRECL=80,BLKSIZE=800)

Creates a temporary data set that exists only for the duration of the job

Accessing a PDS Member

jcl
1
//MEMBER DD DSN=SYS1.PARMLIB(IEAIPS00),DISP=SHR

Refers to member IEAIPS00 in the partitioned data set SYS1.PARMLIB

Creating a New Generation

jcl
1
2
3
4
//GDGFILE DD DSN=PROD.SALES.DATA(+1), // DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(50,10)), // DCB=(RECFM=FB,LRECL=200,BLKSIZE=27800)

Creates a new generation (+1) in the GDG PROD.SALES.DATA

Data Set Concatenation

jcl
1
2
3
//INPUTALL DD DSN=PROD.CURRENT.DATA,DISP=SHR // DD DSN=PROD.HISTORY.DATA,DISP=SHR // DD DSN=PROD.ARCHIVE.DATA,DISP=SHR

Concatenates three data sets to be processed sequentially by the program

Data Set Reference Back

jcl
1
2
3
4
5
6
//STEP1 EXEC PGM=SORT //SORTIN DD DSN=INPUT.DATA,DISP=SHR //SORTOUT DD DSN=SORTED.DATA,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)),DCB=(*.SORTIN) //STEP2 EXEC PGM=REPORT //INPUT DD DSN=*.STEP1.SORTOUT,DISP=SHR

STEP2 refers back to the data set created in STEP1

Special DSN Formats

Backward References

FormatRefers toExample
*.stepname.ddnameData set name from a DD in a previous stepDSN=*.STEP1.OUTPUT
*.stepname.procstepname.ddnameData set name from a DD in a procedure stepDSN=*.STEP1.PROC1.OUTPUT
*.ddnameData set name from a DD in the same stepDSN=*.INPUT

Temporary Data Sets

Temporary data sets are identified using double ampersands (&&) and exist only for the duration of the job. They are automatically deleted at the end of the job.

jcl
1
2
3
//TEMP DD DSN=&&TEMPDS,DISP=(NEW,PASS),SPACE=(TRK,(1,1)) //STEP2 EXEC PGM=PROG2 //INPUT DD DSN=&&TEMPDS,DISP=(OLD,DELETE)

System-Generated Names

If DSN is omitted for a NEW data set, the system generates a unique name. This is not recommended for most situations as it makes the data set difficult to identify.

jcl
1
//SYSUT1 DD DISP=(NEW,DELETE),SPACE=(TRK,(1,1)) // System-generated name

DSN with Symbolic Parameters

Data set names can include symbolic parameters that are resolved during job execution.

jcl
1
2
3
4
5
6
//PROCSTEP PROC DATE=20230101 //OUTFILE DD DSN=PROD.DATA.D&DATE,DISP=(NEW,CATLG,DELETE), // SPACE=(CYL,(10,5)) // PEND //* //STEP1 EXEC PROCSTEP,DATE=20240515

The final data set name would be PROD.DATA.D20240515

Use Cases

Data Processing Workflows

  • Identifying input data files for programs to process
  • Specifying output locations for processed data
  • Connecting multiple job steps through intermediate data sets
  • Creating backup copies of critical data

System Maintenance

  • Accessing system libraries and configuration files
  • Creating new system components during installation
  • Applying maintenance to system datasets
  • Backing up system components before changes

Sequential Processing

  • Daily/weekly/monthly processing cycles with GDGs
  • Creating historical archives of data
  • Processing multiple datasets in sequence via concatenation
  • Creating temporary working files for multi-step processes

Data Management

  • Creating new empty datasets with specific attributes
  • Reorganizing existing data
  • Loading data from one format to another
  • Creating or updating members in partitioned datasets

Common Patterns

PatternPurposeExample
High-level qualifier (HLQ)Organization by owner/projectSYS1.xxxxx, USER.xxxxx
Application identifiersGroup data sets by applicationPAYROLL.MASTER, INVENTRY.DATA
Date/time qualifiersTime-based organizationSALES.D20240101, BACKUP.MONTHLY.JAN
Function identifiersPurpose of the data setACCT.MASTER.BACKUP, SALES.REPORT.INPUT
Environment qualifiersIndicate system environmentDEV.PAYROLL.DATA, PROD.SALES.HISTORY

Limitations

  • Length: Maximum 44 characters for the entire data set name
  • Qualifier length: Maximum 8 characters per qualifier (segment between periods)
  • Character restrictions: Limited to alphanumeric, national characters, and hyphens
  • First character: Must be alphabetic or national character (@, #, $), not numeric
  • Reserved names: Some names are reserved by the system and cannot be used
  • Uniqueness: Data set names must be unique within a catalog structure
  • GDG limitations: Maximum of 255 generations in a GDG

Common Mistakes

  • Invalid characters: Using characters not allowed in data set names
    jcl
    1
    //INVALID DD DSN=USER.FILE-NAME!,DISP=SHR // ! is not valid
  • Qualifier too long: Using qualifiers over 8 characters
    jcl
    1
    //TOOLONG DD DSN=USER.VERYLONGQUAL.DATA,DISP=SHR // VERYLONGQUAL exceeds 8 chars
  • Numeric first character: Starting a data set name with a number
    jcl
    1
    //NUMSTART DD DSN=1DATA.FILE,DISP=SHR // Cannot start with a number
  • Single ampersand for temporary data set: Using & instead of &&
    jcl
    1
    //BADTEMP DD DSN=&TEMP,DISP=(NEW,DELETE) // Should be &&TEMP
  • Missing member name parentheses: Incorrect specification of PDS members
    jcl
    1
    //NOPAREN DD DSN=SYS1.PARMLIB.MEMBER1,DISP=SHR // Should be SYS1.PARMLIB(MEMBER1)
  • Forgotten period in GDG: Incorrect GDG syntax
    jcl
    1
    //BADGDG DD DSN=ACCOUNT.MASTER+1,DISP=OLD // Should be ACCOUNT.MASTER(+1)

Best Practices

  • Consistent naming conventions: Establish and follow standard naming patterns for your data sets
  • Meaningful names: Use descriptive names that reflect content or purpose
  • High-level qualifiers: Use organization-wide standards for HLQs to group related data sets
  • Version control: Use GDGs or date-based naming for versioned data
  • Environment segregation: Include environment indicators (DEV/TEST/PROD) in data set names
  • Symbolic parameters: Use symbolic parameters for date-dependent or variable components
  • Documentation: Maintain documentation of naming standards and meanings
  • Temporary data set management: Use && for true temporary data sets, and create appropriate dispositions
  • Backward references: Use backward references to ensure consistency between steps

Related Concepts

Related Pages