ANS85 

Logic Error Condition with Unsuccessful Completion

If status key 1 contains "4" to indicate a logic error condition, status key 2 can contain one of the following values to indicate the cause of that error:

"1" (all files) Indicates that an OPEN statement has been attempted for a file already in open mode.
"2" (all files) Indicates that a CLOSE statement has been attempted for a file not in open mode.
"3" (all files, sequential access mode only) Indicates that the last input-output statement executed for the associated file, prior to the execution of a DELETE or REWRITE statement, was not a successfully executed READ statement.
"4" (record sequential files only) Indicates that a boundary violation exists. A possible violation is that an attempt has been made to WRITE or REWRITE a record that is larger than the largest, or smaller than the smallest, record allowed by the RECORD IS VARYING clause of the associated file.
"5" (all files ) An attempt has been made to REWRITE a record to a file, and the record is not the same size as the record being replaced.

For line sequential files this refers to the physical size of the record, that is after space removal, tab compression and null insertion. In this case, the physical size of the new record is allowed to be smaller than that of the record being replaced.

"6" (all files) Indicates that a sequential READ statement has been attempted on a file open in input or I-O mode, but no valid next record has been established. This can be caused by the following conditions:
  • The preceding START statement was unsuccessful.
  • The preceding READ statement was unsuccessful but did not cause an at end condition.
  • The preceding READ statement caused an at end condition.
"7" (all files) Indicates that the execution of a READ or START statement has been attempted on a file not open in input or I-O mode.
"8" (all files) Indicates that the execution of a WRITE statement has been attempted on a file not open in I-O, output or extend mode, or on a file open I-O in sequential access mode.
"9" (all files) Indicates that the execution of a DELETE or REWRITE statement has been attempted on a file not open in I-O mode.