MainframeMaster

JCL Tutorial

Special DD Statements

Understanding special types of DD statements and their uses in JCL

Progress0 of 0 lessons

Introduction to Special DD Statements

Beyond the standard DD statements used for defining datasets, JCL provides several special-purpose DD statement types that serve unique functions. These special DD statements help handle specific scenarios such as in-stream data, system output, null datasets, and more.

Understanding these special DD statements is crucial for writing efficient and effective JCL. This tutorial covers the most commonly used special DD statement types and demonstrates how to use them in practical scenarios.

SYSIN DD * (In-stream Data)

The SYSIN DD * statement is used to include data directly within the JCL stream, making it accessible to the program. This is particularly useful for providing small amounts of input data without needing to create a separate dataset.

jcl
1
2
3
4
5
//STEP1 EXEC PGM=SORT //SYSIN DD * SORT FIELDS=(1,10,CH,A) INCLUDE COND=(21,8,CH,EQ,C'ACTIVE') /*

Key Points:

  • The asterisk (*) after DD indicates in-stream data follows
  • Data continues until the delimiter (/*) is encountered
  • Data is treated as 80-byte fixed-length records
  • Commonly used with utility programs like SORT, IEBGENER, and application programs that read from SYSIN

SYSOUT DD (System Output)

The SYSOUT parameter directs output to the Job Entry Subsystem (JES) spool for printing or viewing. It's a crucial part of managing job output in mainframe environments.

jcl
1
2
3
//REPORT DD SYSOUT=A //LISTING DD SYSOUT=*,DEST=REMOTE1 //ERROR DD SYSOUT=A,DCB=(RECFM=FBA,LRECL=133,BLKSIZE=1330)

Key Points:

  • SYSOUT=class specifies an output class (A-Z, 0-9)
  • SYSOUT=* uses the job's message class
  • Additional parameters like DEST can route output to specific locations
  • DCB parameters can be specified for formatting the output

DUMMY DD (Null Dataset)

The DUMMY DD statement creates a "dummy" or null dataset that bypasses all I/O operations. This is useful for testing, bypassing input/output, or satisfying the need for a DD statement without actually reading or writing data.

jcl
1
2
3
//INPUT DD DUMMY //OUTPUT DD DUMMY,DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000) //NULLDD DD NULLFILE // Alternate syntax

Key Points:

  • For input: Simulates an empty dataset (immediate end-of-file condition)
  • For output: Discards all written data
  • DCB parameters can be specified (but are ignored at runtime)
  • NULLFILE is an alternative to DUMMY with identical behavior
  • Useful for testing program logic or bypassing unwanted output

Concatenated DD Statements

Concatenation allows multiple datasets to be treated as a single logical file. This is done by coding DD statements without ddnames immediately following a named DD statement.

jcl
1
2
3
//INPUT DD DSN=PROD.DATA.FILE1,DISP=SHR // DD DSN=PROD.DATA.FILE2,DISP=SHR // DD DSN=PROD.DATA.FILE3,DISP=SHR

Key Points:

  • Only the first DD statement has a ddname
  • Datasets are processed in sequence from top to bottom
  • When end-of-file is reached on one dataset, the next dataset is opened automatically
  • Useful for processing multiple similar datasets or combining data from different sources
  • DCB attributes are taken from the first dataset unless explicitly overridden

PATH DD (Unix System Services Files)

The PATH parameter allows JCL to access files in the Unix System Services (USS) file system, bridging the gap between traditional z/OS datasets and UNIX-style files.

jcl
1
2
3
//UNIXFILE DD PATH='/u/user1/data/config.txt', // PATHOPTS=(ORDONLY), // PATHMODE=(SIRUSR,SIWUSR)

Key Points:

  • PATH parameter specifies the Unix path (case-sensitive)
  • PATHOPTS indicates access mode:
    • ORDONLY: Read-only access
    • OWRONLY: Write-only access
    • ORDWR: Read and write access
    • OCREAT: Create if doesn't exist
    • OTRUNC: Truncate if exists
    • OAPPEND: Append to existing file
  • PATHMODE specifies file permissions (UNIX style)

DISP=MOD (Extend Existing Dataset)

The DISP=MOD parameter allows you to add new records to the end of an existing dataset, rather than overwriting it completely.

jcl
1
//APPEND DD DSN=USER.LOG.DATA,DISP=(MOD,KEEP,KEEP)

Key Points:

  • If the dataset exists, new records are appended to the end
  • If the dataset doesn't exist, it will be created (like NEW)
  • Particularly useful for log files or datasets that accumulate records over time
  • Works with both sequential datasets and members of partitioned datasets

Practical Example: Combining Special DD Statements

The following example demonstrates how multiple special DD statements can be used together in a practical JCL job:

jcl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//SAMPJOB JOB (ACCT),'SPECIAL DD DEMO',CLASS=A //* //STEP1 EXEC PGM=SORT //SYSOUT DD SYSOUT=A //SORTIN DD DSN=PROD.INPUT.DATA,DISP=SHR // DD DSN=PROD.EXTRA.DATA,DISP=SHR //SORTOUT DD SYSOUT=* //SYSPRINT DD SYSOUT=A //SYSDUMP DD DUMMY //SYSIN DD * SORT FIELDS=(1,10,CH,A) INCLUDE COND=(21,8,CH,EQ,C'ACTIVE') /* //* //STEP2 EXEC PGM=MYPROG //INPUT DD DSN=*.STEP1.SORTOUT,DISP=SHR //OUTPUT DD PATH='/u/user1/output/sorted_data.txt', // PATHOPTS=(OWRONLY,OCREAT,OTRUNC), // PATHMODE=(SIRUSR,SIWUSR) //LOG DD DSN=USER.MYLOG.FILE,DISP=(MOD,KEEP,KEEP) //SYSUDUMP DD SYSOUT=A

This job demonstrates:

  • Concatenated input datasets (SORTIN)
  • In-stream data (SYSIN DD *)
  • System output (SYSOUT DD)
  • Dummy dataset (SYSDUMP DD)
  • Unix file access (OUTPUT DD PATH=)
  • Append mode for log file (LOG DD DISP=MOD)
  • Referback to previous step's output (*.STEP1.SORTOUT)

Best Practices for Special DD Statements

1. Documentation

Always include comments (JCL comments start with //*) to explain the purpose of special DD statements, especially when using less common options.

2. Dataset Organization

When concatenating datasets, ensure they have compatible attributes. The first dataset's attributes will typically override others unless explicitly specified.

3. Security Considerations

When using PATH DD statements, always specify appropriate PATHMODE values to ensure proper file permissions and security.

4. Error Handling

Consider using DUMMY for optional datasets that may not be available in all environments, rather than causing job failures.

5. Performance Optimization

Use DUMMY for datasets that are required by a program but not needed for a particular run. This avoids unnecessary I/O operations.

Test Your Knowledge

1. Which DD statement type is used to include data directly within the JCL stream?

  • SYSOUT DD
  • DUMMY DD
  • SYSIN DD *
  • PATH DD

2. What is the purpose of the DUMMY DD statement?

  • To define in-stream data
  • To specify a non-existent dataset that bypasses all I/O operations
  • To designate output for printing
  • To reference a UNIX file

3. How do you designate a dataset for system output (printing)?

  • SYSIN DD
  • SYSOUT=class
  • DUMMY DD
  • PATH DD

4. What does DISP=MOD do when specified for a dataset?

  • Makes the dataset read-only
  • Adds new records to the end of an existing dataset
  • Deletes the dataset after the step completes
  • Creates a temporary copy of the dataset

5. Which DD statement construct is used to access multiple datasets as a single logical file?

  • PATH DD statements
  • DUMMY DD statements
  • DISP=MOD statements
  • Concatenated DD statements

6. Write a JCL statement to access a UNIX file in the directory /u/user1/data/config.txt