PreviousCharacter Sets and Collating Sequences Reserved WordsNext

Appendix C: File Status

C.1 ANSI File Status Summary

See the chapter Environment Divisionand your COBOL system documentation for more details.

C.1.1 ANSI'74 File Status Codes

Status key 1
Status key 2
Description
0 0 Successful completion
  2 Indexed files only. One of two possibilities:
  1. For a READ statement, the key value for the current key is equal to the value of that same key in the next record within the current key of reference.

  2. For a WRITE or REWRITE statement, the record just written created a duplicate key value for at least one alternate record key for which duplicates are allowed.
1 0 There is no next logical record. You have reached the end of the file.
2 1 For sequentially accessed files only. Indicates a sequence error. The ascending key requirement of successive record key values has been violated, or, the prime record key value has been changed by a COBOL program between successful execution of a READ statement and the execution of the next REWRITE statement for that file.
  2 Relative and indexed files only. Indicates a duplicate key value. An attempt has been made to write or rewrite a record that would create a duplicate key in a relative or indexed file.
  3 Indicates no record found. An attempt has been made to access a record, identified by a key, and that record does not exist in the file.
3 0 The input-output statement was unsuccessfully executed as the result of a boundary violation for a sequential file or as the result of an input-output error, such as a data check parity error, or a transmission error.
  4 The input-output statement failed because of a boundary violation. This condition indicates that an attempt has been made to write beyond the externally defined boundaries of a sequential file.
9   Extended file Status Code

C.1.2 ANSI'85 File Status Codes

ANSI'85 file status codes include all ANSI'74 together with the following status codes:

Status key 1
Status key 2
Description
0 4 The length of the record being processed does not conform to the fixed file attributes for that file.
  5 The referenced optional file is not present at the time the OPEN statement is executed.
  7 Sequential files only. For a CLOSE statement with the REEL/UNIT phrase the referenced file is a non-reel/unit medium.
1 4 Relative files only. The number of significant digits in the relative record number is larger than the size of the relative key data item described for that file.
2 2 For indexed and relative files only, indicates a duplicate key condition. An attempt has been made to store a record that would create: a duplicate key in the indexed or relative file or a duplicate alternate record key for a file that does not allow duplicates.
  3 The conditions listed under ANSI'74 code "23". In addition, a START or READ statement has been attempted on an optional input file that is not present.
  4 Relative and indexed files only: Indicates a boundary violation arising from one of the following conditions:
  1. An atttempt has been made to write beyond the externally defined boundaries of a file.

  2. A sequential WRITE statement is attempted for a relative file, but the number of significant digits in the relative record number is larger than the size of the relative key data item described for the file.
3 5 An OPEN statement with the I-O, INPUT, or EXTEND phrases has been attempted on a nonOPTIONAL file that is not present.
  7 An OPEN statement has been attempted on a file which does not support the open mode specified in the OPEN statement.
  8 An OPEN statement has been attempted on a file previously closed with a lock.
  9 A conflict has been detected between the fixed file attributes specified for that file in the program.
4 1 An OPEN has been attempted on a file already opened.
  2 A CLOSE has been attempted on a file already closed.
  3 Files in sequential access mode: the last I-O statement executed for the file, prior to the execution of a DELETE or REWRITE statement, was not a READ statement.
  4 A boundary violation exists.
  6 A sequential READ statement has been attempted on a file open in the INPUT or I-O mode but no valid next record has been established.
  7 A READ or START statement has been attempted on a file not opened INPUT or I-O.
  8 A WRITE statement has been attempted: on a file not open in the OUTPUT, I-O or EXTEND mode; or on a file open in the I-O and sequential access modes.
  9 A DELETE or REWRITE statement has been attempted on a file that is not opened I-O.


Copyright © 2000 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousCharacter Sets and Collating Sequences Reserved WordsNext