Microsoft KB Archive/40044

Run-Time Error Printed Incorrectly with MS(2) Directive

PSS ID Number: Q40044 Article last modified on 04-20-1993

3.00 3.00a | 3.00 3.00a MS-DOS | OS/2

Summary: The example program on Pages 7-20 of the “Microsoft COBOL Version 3.0: Operating Guide” is used to display the number of a run-time error. With the MS(2) directive set, this program does not display the error number, but the ASCII character represented by the error number. To correct the program so that it will run with the MS(2) directive, the REDEFINES field needs to be changed from a COMP field to a COMP-0 field. The original line reads as follows: 01 STAT-BIN REDEFINES FILE1-STAT PIC 9(4) COMP. It should be changed to the following: 01 STAT-BIN REDEFINES FILE1-STAT PIC 9(4) COMP-0.

More Information: The MS(2) directive causes the internal representation of a COMP field to change. Instead of being a 2-byte integer field, it is represented with one byte for each digit. This is the same format as a PIC 9(4) field. The program will not work properly unless the REDEFINES field is in two byte integer format.

Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.