COBOL - USAGE Clause - COMPUTATIONAL-3 or COMP-3 (internal decimal)



Desenvolvido por DORNELLES Carlos Alberto - Analista de Sistemas - Brasília DF. - cad_cobol@hotmail.com

COBOL - USAGE Clause - COMPUTATIONAL-3 or COMP-3 (internal decimal)

This is the equivalent of PACKED-DECIMAL.

Internally, the rightmost byte of a packed decimal item contains a digit and a sign, and any other bytes contain two digits.

If you use the more efficient configuration, the compiler does not need to supply the missing digit.

The contents of the leftmost (unused) digit position of the storage allocated for a packed decimal item that contains an even number of digits can change when the value of the item is changed.
This might lead to unexpected results if, for example, the item is redefined, forms part of a group field, or is used as a key to an indexed file.

COMP-3 is 8 bytes.

Comp-3 is used for Packed Decimal values it allows S 9 V mostly it is useful for Decimal Calculation Values.

COMP-3 stores the data in the BCD(Binary Coded Decimal)format.

It is used to avoid rounding issues that occur when binary numbers are used to represent decimal fractions.

This is particularly vital in systems that method massive volumes of economic transactions/amounts

    Memory usage is

  • n/2 + 1 (Even)
  • n+1/2 (odd)


© Copyright IBM.