Previous Topic Next topic Print topic


COMP-6/COMPUTATIONAL-6 Data

The RM/COBOL system holds COMP-6 data in a similar format to COMP-3 data, except there is no sign half-byte. If a sign is indicated in the picture clause it is ignored and has no effect. The value held is always positive.

Consider the following examples:

Value Picture Clause RM Representation (Hexadecimal)
1234 PIC 9(5) COMP-6 00 12 34
123456 PIC S9(6) COMP-6 12 34 56

In order to maintain the size and capacity of the data items, this COBOL system treats COMP-6 data items as this COBOL's COMP format fields, and pads the field with binary zeros where necessary. The examples above are represented as follows:

Value Picture Clause This COBOL's Representation (Hexadecimal)
1234 PIC 9(5) COMP-6 00 04 D2
123456 PIC S9(6) COMP-6 01 E2 40

The 9(5) COMP field is extended by one byte containing binary zero in order to maintain the size of the original item. See the section COMPUTATIONAL-6 (COMP-6) Data Types in the chapter Compatibility with RM/COBOL for details.

Previous Topic Next topic Print topic