Microsoft KB Archive/40142
Internal Format of COMP Field Different with MS(2)
PSS ID Number: Q40142 Article last modified on 04-20-1993
3.00 3.00a | 3.00 3.00a MS-DOS | OS/2
|The information in this article applies to:|
|- Microsoft COBOL for MS-DOS and OS/2, versions 3.0 and 3.0a|
Summary: A COMP field can be represented in memory in the following two ways: 1. Without the MS(2) directive, a PIC 9(4) COMP field is stored in 2-byte integer format with the Most Significant Byte first. This is the same storage method as a PIC 9(4) COMP-0 data item. 2. With the MS(2) directive, a PIC 9(4) COMP field is stored in ASCII format with each byte representing a digit. This is the same storage method as a PIC 9(4) data item.
More Information: Microsoft COBOL Versions 2.x store their COMP fields in ASCII format. Using the MS(2) directive causes the storage type to be different than the default to keep compatibility with Microsoft COBOL Versions 2.x. If 10 was moved to a PIC 9(4) COMP field, the internal format with and without the MS(2) directive would be as follows: With MS(2) Without MS(2) hex: 30 30 31 30 00 0A ASCII: 0 0 1 0 no printable ascii equivalent display: +0010 +0010
Additional reference words: 3.00 3.00a Copyright Microsoft Corporation 1993.