When an input or output operation fails, COBOL does not automatically take corrective action. You choose whether your program will continue running after a less-than-severe input or output error.
You can use any of the following techniques for intercepting and handling certain input or output conditions or errors:
To have your program continue, you must code the appropriate error-recovery procedure. You might code, for example, a procedure to check the value of the file status key. If you do not handle an input or output error in any of these ways, a COBOL runtime message is written and the run unit ends.
The following figure shows the flow of logic after a file-system input or output error:

related tasks
Opening optional files
Using the end-of-file condition (AT END)
Coding ERROR declaratives
Using file status keys
Using file system status codes
Coding INVALID KEY phrases
related references
File status key (COBOL for AIX Language Reference)