INPUT/OUTPUT STATEMENTS/VERBS
OPEN statement
It is used to open the file or files if these are defined in Environment Division.It generates the resources of getting in or putting out the data of input/output buffers.
Format
- OPEN INPUT (List of file names)
- OPEN OUTPUT (List of file names)
- OPEN INPUT (list of files) OUTPUT (list of files)
- OPEN OUTPUT (list of files)
- OPEN I-O (list of files)
- OPEN EXTEND (list of files)
Examples:
OPEN INPUT CARD-FILE.
OPEN INPUT TAPE-FILE.
OPEN OUTPUT PRNT-FILE.
OPEN INPUT CARD-FILE TAPE-FILE OUTPUT PRINT-FILE.
OPEN EXTEND AFILE I-O BFILE.
CLOSE statement
It is used to close the file or files after the processing of the opened files. It de-activates or releases the resources of getting in or putting out the data of input/output buffers.
FORMAT
CLOSE (List of files).
Example:
CLOSE CARD-FILE TAPE-FILE PRNT-FILE.
Point:
Function of OPEN statement is to open the files as Input or Output and CLOSE statement is to close the files of any category.
More about input/output statements
ACCEPT Statement ---
DISPLAY Statement ---
READ Statement ---
WRITE Statement ---

PROCEDURE DIVISION Page