Input-output statements

COBOL input-output statements transfer data to and from files stored on external media, and also control low-volume data that is obtained from or sent to an input/output device.

In COBOL, the unit of file data made available to the program is a record. You need only be concerned with such records. Provision is automatically made for such operations as the movement of data into buffers, internal storage, validity checking, error correction (where feasible), blocking and deblocking, and volume-switching procedures.

The description of the file in the ENVIRONMENT DIVISION and the DATA DIVISION governs which input-output statements are allowed in the PROCEDURE DIVISION. Permissible statements for sequential files are shown in Table 2 , and permissible statements for indexed files and relative files are shown in Table 3. Permissible statements for line sequential files are shown in Table 4.