COBOL Comp-1 COBOL Comp-3


COMP-2 usage clause will be called as Hexadecimal form.

COMP-2 usage clause applicable to double floating point data type.

COMP-2 is specified for internal floating point items which is double precision.

COMP-2 items are 8 bytes long.

PICTURE clause should not be specified.

COMP-2 allows Signed floating point item where the sign will store on leftmost byte first bit which is allocated to exponent.

In the 8 bytes, leftmost 12 bits to store exponent and remaining 52 bits stores mantissa.

The COMP-2 memory calculations like below.

COMP-2 will store the data in the format of mantissa and exponent.

Here Mantissa is numeric value and exponent is the precision number.

For example, 9.999 value needs to be stored in COMP-2. The data can be stored in the memory like 9999 * 10-3.

9.999 equal to 9999 * 10-3.

In the above, 10-3 is exponent value (stored in left most 12 bits) and 9999 is mantissa (stored in remaining 52 bits).

Practicle Example:

If any questions on the above, post your queries on Cobol Discussion forum

COBOL Comp-1 COBOL Comp-3