Monday, 28 July 2014

COBOL File Status Code.

FILE STATUS clause can be used with both sequential and Index file. The following are possible values that may be placed in the FILE STATUS field when an input or output operation is performed. 

Note : If the leftmost character in the FILE STATUS is a 0, the input or output operation was successfully completed. If it is not zero, then the I/O operation result in an error. 

FILE STATUS field after an Input or Output operation

                     Successful Completion of I/O Operation.


  • Successful completion - no error occurred. 
  • The record being processed has a duplicate alternate record key.
  • A READ statement has been successfully completed, but the length of the record does not conform to the File Description specifications.
                          Unsuccessful Completion of I/O Operation.
  • A sequential READ statement (READ…AT END) has been attempted, but there are no more input records.
  • A sequence error has occurred - keys are not in the correct order
  • An attempt was made to write a record that would create a duplicate primary record key.


  • The required record was not found during a READ.
  • A boundary error has occurred - an attempt has been made to write beyond the pre-established boundaries of an indexed file as established by the operating system.
  • A permanent date error has occurred (this is a hardware problem.)

  • A boundary error for a sequential file has occurred.
  • A permanent error has occurred because an OPEN statement has been attempted on a file that will not support the mode specified in the OPEN statement (e.g., an indexed file is opened as OUTPUT when ACCESS IS RANDOM has been specified, or a print file is opened as I-O).

  • An OPEN statement has been attempted on a file that is already open

  • A CLOSE statement has been attempted on a file that has not been opened.

  • An attempt has been made to DELETE or REWRITE a record after an unsuccessful READ (e.g., there is no record in storage to delete or rewrite).
  • Codes of 91-99 are implementation specific - consult your user's manual.

Note: * Indicates that codes applies to index/relatives files.

Created with Artisteer

No comments:

Post a comment