Defining a File Status [ Micro Focus COBOL System Reference, Volume 2 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 2
Defining a File Status
Each file in a program can have a file status item attached to it. A
separate item can be used for each file's file status, or a single item
can be used for the file status of several files. The data item to be
used for the file status of a file is indicated in the SELECT clause of
the File-Control paragraph for that file. The data item used for a file
status is defined in the Working-Storage or Linkage Section.
For all file status conventions, except extended file status codes, the
data item is defined as two character alphanumeric (that is PIC XX).
Extended file statuses use the second byte of the status as a binary
(COMP-X) item.
A value of 0 is placed in the first byte of this data item if an I/O
operation is successfully executed. A value of 1, 2, 3 or 4 in the first
byte indicates that an error has occurred during an I/O operation on the
file. These errors are fully defined by the ANSI standard and are
described in the Language Reference.
A value of 9 in the first byte indicates that an error has occurred
during an I/O operation on the file. In this case, the associated
run-time error number is placed in the second byte in binary (COMP)
format. A full description of such run-time errors can be found in the
Error Messages, together with any corrective actions you can make to
recover from the condition which caused the error.
Example
select in-file
assign to....
. . .
file status is ws-file-status.
data division.
file section.
fd in-file....
. . .
working-storage section.
01 ws-file-status pic xx.
MPE/iX 5.0 Documentation