Image description: error handling for VSAM files

This image is a flowchart that shows the flow of execution after an input or output error on a VSAM file.

The following steps describe input-output system processing:

  1. The file status field is set if a FILE STATUS clause was specified for the file.
  2. The program is checked for the presence of the following error handling features, in the order shown:
    1. An associated AT END exception phrase. The imperative statements associated with that exception phrase are executed.
    2. An associated ON INVALID KEY exception phrase. The imperative statements associated with that exception phrase are executed.
    3. An associated error declarative, such as USE AFTER EXCEPTION. The declarative procedure is executed.
    4. A FILE STATUS clause for the file.
  3. After one of the error handling features is found and any associated code is executed, the input-output system returns control to the COBOL program at the end of the I/O statement. Normal processing continues.
  4. If none of the error handling features is found, the following action is taken:
    1. If the error occurred in an OPEN or CLOSE statement, normal processing continues.
    2. If the error occurred in another input-output statement, such as a READ or a WRITE, the run unit is terminated with a message.

End of image description.