ACCEPT and the SCREEN section
ACCEPT
ACCEPT reads a line from the input device into a field. On a terminal it waits for the user to type Enter; with input redirection it reads the next line of the file:
DISPLAY "Enter employee number: ".
ACCEPT WS-EMP-NO.
ACCEPT FROM
ACCEPT FROM names the source: SYSIN for the standard input stream, ENVIRONMENT for an environment variable, and ARGUMENT for command-line values:
ACCEPT WS-COUNT FROM ENVIRONMENT "ROW-COUNT".
ACCEPT WS-FIRST-ARG FROM ARGUMENT-VALUE.
SCREEN section
The SCREEN section of DATA DIVISION describes a form: field position, size, and default value. ACCEPT the screen to read it, and DISPLAY the screen to paint it. Terminal screens are legacy but still run on 3270 emulators.
The code on this page was run with GnuCOBOL 3.2.0 on Alpine Linux 3.24.3 (x86_64) in a Docker container.
Article author: Arthur Isaev