SYSOUT DD Statement
The SYSOUT DD statement is used to specify where to route the output produced by a job step. It defines the destination for the output, which can include printing on paper, writing to a dataset, or discarding the output.
Syntax -
//SYSOUT DD destination-information
- //SYSOUT - is the DD statement label, which uniquely identifies the output definition.
- destination-information - specifies the destination for the output. This can include parameters that control the destination and characteristics of the output.
- SYSOUT=* - Send the output to the system operator's console.
- SYSOUT=printer-name - Send the output to a specific printer identified by its name.
- DSN=dataset-name - Write the output to a dataset with the specified name.
Examples -
Scenario1 - Writing to spool.
//TESTJOB JOB ...
//STEP1 EXEC PGM=PROG1
//SYSOUT DD SYSOUT=*
//SYSIN DD *
...
In this example, any standard output produced by the job step will be displayed on the spool.
Scenario2 - Writing to a dataset (MATEPK.SYSOUT.PS).
//TESTJOB JOB ...
//STEP1 EXEC PGM=PROG1
//SYSOUT DD DSN=MATEPK.SYSOUT.PS,
// UNIT=3390,
// VOLUME=SER=123456,SPACE=(CYL,(0,1)),
// DISP=(NEW,CATLG,DELETE)
//SYSIN DD *
...
In this example, the output is directed to a dataset named "MATEPK.SYSOUT.PS". The DISP parameter specifies that if the dataset does not exist, it should be created (NEW) and cataloged (CATLG).
Scenario3 - Discarding output
//SYSLST DD DUMMY
This example discards any output produced by the job step. It is useful when we don't need the output and want to save resources.