Handling errors in input and output operations

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:

This image shows the logic flow after an I/O error.
Link to detail.

related references  
File status key (COBOL for AIX Language Reference)