Monday, 28 July 2014

COBOL Close Statement.

The CLOSE statement terminates the processing of the file. As a result of the execution of the CLOSE statement, the IOCS performs the end of file processing.

The record buffer created for the corresponding file gets destroyed and thus the link between the program and the file is lost.

The CLOSE statement is optional from COBOL-85.

The STOP RUN statement automatically closes all the files that were opened by the program. The
CLOSE statement can be used with the LOCK option, which prevents the file to be opened again in the same program.


Format :

 

Example :

Note: Though it is possible to OPEN and CLOSE more than one file at a time, programmers are advised not to do so. This is because if opening or closing of any particular file is unsuccessful, then it is impossible to identify that file using the FILE STATUS as it applies to all the files.

Created with Artisteer

No comments:

Post a Comment