SYSIN DD Statement
SYSIN DD 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.
The SYSIN is used to specify the dataset name for the input source that contains the control statements or data. The dataset can be either a partitioned dataset or a sequential dataset.
SYSIN DD statement is also called as instream DD statement.
Syntax -
//SYSIN DD *[|DATA]
data-input
/*
(or)
//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.
Examples -
Scenario1 - SYSIN statement with a dataset.
//SYSIN DD DSN=input.data.set,DISP=SHR
Scenario2 - The below example shows how the SYSIN data is accepted in the program.
Run JCL -
----+----1----+----2---+---3---+---4---+---5---+
//MTHUSERJ JOB (META007),'PAWAN Y',CLASS=A,MSGCLASS=L,MSGLEVEL=(1,1),
// TIME=1440,NOTIFY=&SYSUID
//*
//JOBLIB DD DSN=MTHUSER.MY.LOADLIB,DISP=SHR
//*
//STEP01 EXEC PGM=DATECONV
//STEPLIB DD DSN=MTHUSER.TEST.LOADLIB,DISP=SHR
//SYSIN DD *
20230101
/*
//SYSPRINT DD SYSOUT=*
//SYSOUT DD SYSOUT=*
COBOL Program -
----+----1----+----2---+---3---+---4---+---5---+
IDENTIFICATION DIVISION.
PROGRAM-ID. DATECONV.
ENVIRONMENT DIVISION.
DATA DIVISION.
WORKING-STORAGE SECTION.
01 WS-DT-INP PIC 9(08).
01 WS-DT-OP1 PIC 9(07).
01 WS-DT-OP2 PIC 9(08).
PROCEDURE DIVISION.
ACCEPT WS-DT-INP.
COMPUTE WS-DT-OP1 = FUNCTION DAY-OF-INTEGER (FUNCTION
INTEGER-OF-DATE (WS-DT-INP) - 1)
COMPUTE WS-DT-OP2 = FUNCTION DATE-OF-INTEGER (FUNCTION
INTEGER-OF-DATE (WS-DT-INP) - 1)
DISPLAY 'DATE OUTPUT1 : ' WS-DT-OP1.
DISPLAY 'DATE OUTPUT2 : ' WS-DT-OP2.
STOP RUN.