Microsoft KB Archive/36029

From BetaArchive Wiki

COMP-1 & COMP-2 Not Implemented As Floating Point in MS COBOL

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

2.00 2.10 3.00 3.00a 4.00 | 3.00 3.00a 4.00 MS-DOS | OS/2

The information in this article applies to:
- Microsoft COBOL for MS-DOS, versions 2.0, 2.1, 3.0, 3.0a, and 4.0 - Microsoft COBOL for OS/2, versions 3.0, 3.0a, and 4.0

Summary: Although Microsoft COBOL may not give a compile-time error for COMP-1 and COMP-2 data item syntax, COMP-1 and COMP-2 are not implemented as floating point data types in Microsoft COBOL version 2.0, 2.1, 2.2, 3.0, 3.0a, or 4.0. If you are converting COMP-1 or COMP-2 COMPUTATIONAL numeric types, such as from IBM/370 mainframe COBOL, you will need to change the source code USAGE for COMP-1 to COMP-0, and change COMP-2 to COMP-3, before compiling in Microsoft COBOL.

More Information: The fact that Microsoft COBOL doesn’t implement COMP-1 and COMP-2 is not a violation of the American National Standard Institute (ANSI) COBOL specifications (ANSI X3.23-1974 or ANSI X3.23-1985). ANSI does not require COMPUTATIONAL data types to be the same in different COBOL implementations, as indicated in the following quotation from page vi-47 of the “American National Standard for Informations Systems - Programming Language - COBOL ()”: The USAGE IS COMPUTATIONAL clause specifies that a radix and format specified by the implementor is used to represent a numeric item in the storage of the computer. Each implementor specifies … the alignment and representation of the data item in the storage of the computer, including the representation of any algebraic sign, and upon the range of the values that the data item can hold. Some implementations of COBOL (such as IBM/370 mainframe COBOL) use COMP-1 and COMP-2. But COMP-1 and COMP-2 are not implemented in Microsoft COBOL. Also, Microsoft COBOL cannot process the internal floating point representations of numbers that are used by other Microsoft languages. However, fixed decimal point tokenized representations of real numbers can be passed between COBOL and other Microsoft languages. To find examples of this, query on the following words: COBOL and floating and point

Additional reference words: 2.00 2.10 3.00 3.00a 4.00 Copyright Microsoft Corporation 1993.