Alternate File Status Table [ Micro Focus COBOL System Reference, Volume 2 ] MPE/iX 5.0 Documentation
Micro Focus COBOL System Reference, Volume 2
Alternate File Status Table
This COBOL system for UNIX supplies a C source file, filestat.c, which
contains tables of the file status values defined by ANSI '74 and ANSI
'85 standards. We do not recommend that you change these tables in any
way.(UNIX)
However, this file also contains a table giving an alternate set of file
status values for those input-output error conditions which return a
value of 9 in the first byte. You can alter this table if you want. By
default, this alternate set of error numbers is output by RM/COBOL.
If you want this COBOL system to output error messages from this list,
rather than from its standard list of run-time error messages as defined
in the Error Messages, you must either:
* compile your program with the RM directive set. See the chapter
Compiling and the appendix Directives for Compiler for further
information on this option
or:
* specify the +Q
file status error switch when you run your program. See the
appendix Descriptions of Run-time Switches for further information
on this run-time switch.
The C source file, filestat.c, containing the alternate file status
tables is stored in $COBDIR/src. If you want to alter the default table
of alternate file status item values to a set of values which conform to
the statuses returned in the COBOL dialect of your choice, you must index
the table using the second byte of any status 9 items. The table entry
then contains the new value for that file status in Binary Coded Decimal
(BCD) format. Any undefined or unrecognized status values are mapped
onto status 30 "permanent I-O error".
Once you have altered the table, you must rebuild the Run-Time System so
that it uses your altered version of filestat.c rather than the original
version. You can either do this globally or individually for each
Run-Time System. The following sections show you how to do this.
Globally Altering File Status Values
To globally rebuild the Run-Time System on UNIX systems so that it uses
your altered version of filestat.c when outputting file status error
messages, you must perform the following:(UNIX)
1. Compile your new version of the module by entering the command:
cc -c filestat.c
As any further run-time systems that you build will use the new
version of filestat.c, we recommend that you keep a copy of the
original version.
2. Replace filestat.o in the COBOL library by entering:
ar rv $COBDIR/coblib/libcobol.a filestat.o
3. Rebuild the Run-Time System using the cob command. For example:
cd $COBDIR cob -xvo rts32
See the chapter COBOL System Interface earlier in this manual for further
details of the cob command.
Altering File Status Values for Individual Run-Time Systems
On UNIX systems, you can use the cob command to rebuild a single Run-Time
System so that it uses your altered version of filestat.c when outputting
file status error messages.
If you have not already compiled filestat.c, you enter the command:
cob -o rts32 filestat.c -e ""
If you have compiled filestat.c, you enter:
cob -o rts32 filestat.o -e ""
As usual, you can include any COBOL or C programs or other object modules
in the command line.
See the chapter COBOL System Interface earlier in this manual for a full
description of the cob command.
MPE/iX 5.0 Documentation