Input & Output Statements


In Job Control Language (JCL), the input and output statements are used to define the data sets or files that a batch job (a job that executes a COBOL program) will use during its execution. These statements specify where the input data is coming from and where the output data should be written to.

These statements are required when the program is accepting input or writing output. In all other scenarios, these statements are act as dummy statements. The JCL input and output statements are -

SYSIN Statement

The SYSIN DD statement is used to provide the input source for programs or utilities in the JCL. It is typically used to provide control statements or data to the program that is being executed.

Syntax -

//SYSIN DD DSN=input.dataset.name,DISP=SHR
  • //SYSIN - is the DD (Data Definition) statement label, which is used to identify the data set definition.
  • DSN=input.dataset.name - specifies the name of the input data set. input.dataset.name should be replaced with the actual data set name.
Example - SYSIN statement with a dataset.
//SYSIN  DD  DSN=input.data.set,DISP=SHR

SYSOUT 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.
    • 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.
Example - 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".

Learn More?