Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Input/output statements

In COBOL, input and output are record-oriented. Thus the READ, WRITE, DELETE and REWRITE statements process records. The COBOL user is therefore only concerned with the processing of individual records. The following operations are performed automatically:

  • moving data into input/output areas (buffers) and/or internal storage

  • validity checking

  • correcting errors (where feasible)

  • blocking/unblocking

  • switching volumes (only for sequential file organization).


Note

The description of input/output statements for sequentially organized files uses the expressions "volume" and "reel". Volume may be used for all input/output devices; reel is applicable to magnetic tape devices only. The handling of disk storage files with sequential access is logically equivalent to the handling of magnetic tape files.

Overview

Statement

Function

CLOSE

Terminates processing of a file

DELETE

Deletes a record

OPEN

Opens a file for processing

READ

Reads a record

REWRITE

Replaces a record

START

Positions within a file

USE

In addition to input/output statements, USE statements may be supplied to specify error handling procedures (see section "DECLARATIVES")

WRITE

Writes a record

DELETE and START are only applicable to relative and indexed file organization.