COBOL File Status

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 3

Common COBOL I/O File Status Code

File I/O File Access Condition represented by the code


status statements organisation mode
00 All All All Successful operation
02 REWRITE Indexed All Successful operation, but the record just
written created a duplicate key value for an

m
WRITE alternate record key for which duplicates
are allowed.

.co
04 READ All All Successful operation, but the size of the
record just read does not agree with the size
specified in the program.

ES
05 OPEN All All Successful operation, but the referenced
optional file was not present when the
statement executed. (if the open mode was
I-O or EXTEND, the file was created.)

M
07 CLOSE All All Successful operation, but the referenced file
is not on a reel-type device. The
OPEN
A NOREWIND, REEL/UNIT or FOR
REMOVAL options of the CLOSE
statement are overlooked, or the
FR

NOREWIND phrase of the OPEN


statement is overlooked.
10 READ All Sequential Operation failed because EOF was detected
IN

or an optional file was not present.


14 READ Relative Sequential Operation failed because the number of
digits in the relative key value is greater
A

than the size specified for the relative key


data item.
M

15 READ All Sequential Operation failed because an optional file


was not present, and this was the first
attempt to read it.
M

21 DELETE Indexed or Sequential Operation failed because of a sequence


error: prime record (for an indexed file) or
IB

REWRITE Relative Sequential relative key (for a relative file) was not the
same as the last record read.
WRITE Indexed Sequential
Operation failed because the prime record
Indexed key value changed between the previous
successful READ and the current
REWRITE operation.
Operation failed because the prime record
key value was not greater than that of the
last record written. (Prime record key
values must be in ascending order.)
22 REWRITE Indexed All Operation failed because it would have
created a duplicate alternate record key
WRITE Indexed All when duplicates are not allowed.

m
Relative Random Operation failed because a duplicate prime
or record key, or a duplicate alternate record

.co
key when duplicates are not allowed, would
Dynamic have been created.

Operation failed because a duplicate

ES
relative key would have been created.
23 DELETE Indexed or Random Operation failed because the record key
or (prime or alternate for indexed file, relative

M
READ Relative key for relative files) was not found or an
Dynamic optional file was not present.
REWRITE Indexed or
A
Sequential Operation failed because the record key
START Relative or (prime or alternate for indexed files,
FR
relative key for relative files) was found, or
Dynamic an optional file was not present.
24 WRITE Indexed or All Operation failed because an attempt was
IN

made to write beyond the externally


Relative defined boundaries for an indexed or
relative file; or a sequential write operation
was attempted for a relative file but the
A

number of digits in the relative key value


exceeded the size specified for the relative
M

key data item.


25 READ Indexed or All Operation failed because a START
M

statement or a random READ statement


START Relative was attempted on an optional file that was
snot present.
IB

30 All All All Operation failed due to an error that cannot


be specified by other status codes.
34 WRITE Sequential Sequential Operation failed because an attempt was
made to write beyond the externally
defined boundaries for the file.
35 OPEN All All Operation failed because an attempt was
made to open a nonoptional file in INPUT
mode but eh file was not present.
37 OPEN All All Operation failed because an attempt was
made to open a file in I-O mode when the
device does not support a mass storage file.
38 OPEN All All Operation failed because an attempt was
made to open a file that was previously
closed with a lock.

m
39 OPEN All All Operation failed because an attempt was
made to open a file whose fixed file

.co
attributes do not match the ones specified in
the program. (Attributes that are checked
are organisation, index keys (prime and
alternate), block size, and maximum record

ES
size.)
41 OPEN All All Operation failed because an attempt was
made to open a file that was already open.

M
42 CLOSE All All Operation failed because an attempt was
A made to close a file that was not open.
43 DELETE All Sequential Operation failed because an attempt was
made to delete or rewrite a record without a
FR
REWRITE prior successful READ for the record.
44 REWRITE All All Operation failed because an attempt was
made to rewrite a record whose size is not
the same as the record being replaced.
IN

46 READ All Sequential Operation failed because an attempt was


made to read a record from a file open in
INPUT or I-O mode when no valid next
A

record has been established within the file.


47 READ All All Operation failed because an attempt was
M

made to read or start a file that was not


START open, or was not open in INPUT or I-O
M

mode.
48 WRITE All All Operation failed because an attempt was
made to write to an unopen file, or to a file
IB

not open in OUTPUT, I-O, or EXTEND


mode.
49 DELETE All All Operation failed because an attempt was
made to delete or rewrite a record of an
REWRITE unopen file, or of a file not open in I-O
mode.

You might also like