SYSOUT Statement Example


Scenario1 - Writing to spool.

Code -

----+----1----+----2----+----3----+----4----+----5----+
//TESTJOB JOB ...
//STEP1    EXEC PGM=PROG1
//SYSOUT   DD SYSOUT=*
//SYSIN DD *
...

Explaining Example -

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).

Code -

----+----1----+----2----+----3----+----4----+----5----+
//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 *
...

Explaining Example -

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

Code -

----+----1----+----2----+----3----+----4----+----5----+
//SYSLST DD DUMMY

Explaining Example -

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.