Understanding special types of DD statements and their uses in JCL
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.
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.
12345//STEP1 EXEC PGM=SORT //SYSIN DD * SORT FIELDS=(1,10,CH,A) INCLUDE COND=(21,8,CH,EQ,C'ACTIVE') /*
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.
123//REPORT DD SYSOUT=A //LISTING DD SYSOUT=*,DEST=REMOTE1 //ERROR DD SYSOUT=A,DCB=(RECFM=FBA,LRECL=133,BLKSIZE=1330)
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.
123//INPUT DD DUMMY //OUTPUT DD DUMMY,DCB=(RECFM=FB,LRECL=80,BLKSIZE=8000) //NULLDD DD NULLFILE // Alternate syntax
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.
123//INPUT DD DSN=PROD.DATA.FILE1,DISP=SHR // DD DSN=PROD.DATA.FILE2,DISP=SHR // DD DSN=PROD.DATA.FILE3,DISP=SHR
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.
123//UNIXFILE DD PATH='/u/user1/data/config.txt', // PATHOPTS=(ORDONLY), // PATHMODE=(SIRUSR,SIWUSR)
The DISP=MOD parameter allows you to add new records to the end of an existing dataset, rather than overwriting it completely.
1//APPEND DD DSN=USER.LOG.DATA,DISP=(MOD,KEEP,KEEP)
The following example demonstrates how multiple special DD statements can be used together in a practical JCL job:
123456789101112131415161718192021//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
Always include comments (JCL comments start with //*) to explain the purpose of special DD statements, especially when using less common options.
When concatenating datasets, ensure they have compatible attributes. The first dataset's attributes will typically override others unless explicitly specified.
When using PATH DD statements, always specify appropriate PATHMODE values to ensure proper file permissions and security.
Consider using DUMMY for optional datasets that may not be available in all environments, rather than causing job failures.
Use DUMMY for datasets that are required by a program but not needed for a particular run. This avoids unnecessary I/O operations.
1. Which DD statement type is used to include data directly within the JCL stream?
2. What is the purpose of the DUMMY DD statement?
3. How do you designate a dataset for system output (printing)?
4. What does DISP=MOD do when specified for a dataset?
5. Which DD statement construct is used to access multiple datasets as a single logical file?
6. Write a JCL statement to access a UNIX file in the directory /u/user1/data/config.txt