COBOL ACCEPT

We can use the ACCEPT Statement to accept the value from the JCL or a system defined value.

Syntax:​

ACCEPT IDENTIFIER FROM [Mnemonic-name]

Example:​

1. ACCEPT EMPLOYEE-DETAILS.
Here the value of EMPLOYEE-DETAILS will be provided from the JCL during the runtime of the JCL. You can pass data from JCL using SYSIN or PARM.

2. ACCEPT CURRENT-DATE-VAL FROM DATE.
Here the value of CURRENT-DATE-VAL will be fetched from the system defined DATE.

3. ACCEPT CURRENT-TIME-VAL FROM TIME.
Here the value of CURRENT-TIME-VAL will be fetched from the system defined TIME.

SYSIN Parameter in JCL:​

1. SYSIN Parameter is used in JCL(JOB CONTROL LANGUAGE) to pass the data from JCL to COBOL Program.

2. ACCEPT Statement is coded in COBOL Program to receive the Data which is passed from the SYSIN of the JCL.

Syntax of SYSIN format 1:​

a)  //SYSIN DD * values…
      /*
Here, DD * – In-stream data

b) //SYSIN DD DATA values…
       //*

Let us take an Example of complete flow of ACCEPT Statement

TutorialBrain-ACCEPT Statement in COBOL Program- Part 1
TutorialBrain-ACCEPT Statement in COBOL Program- Part 2
COBOL Program accepts the data from JCL using SYSIN
TutorialBrain-SYSIN coded in JCL passes value to COBOL Program
JCL passing data to the COBOL Program through SYSIN

Output

ADDITION OF TWO NUMBERS USING SYSIN
46​

Tutorials for all brains!