COBOL COMP-3

COBOL COMP-2 COBOL Programming Construction

Advertisements


COMP-3 usage clause will be called as packed decimal form.

COMP-3 usage clause is applicable for numeric data type.

COMP-3 will store the data as packed. i.e. two digits in each byte.

COMP-3 data will be stored in memory as BCD (Binary Coded Decimal) Format.

COMP-3 data stored in memory higher to lower in the size of nibble (4 bits). i.e. The upper nibble stores the most significant digit and lower nibble stores the next digit and the upper nibble stores the next digit etc,.

COMP-3 allows Signed packed decimal item where the sign will store on least significant digit (rightmost lower nibble).

In COMP-3 Sign always table one nibble so always even number of nibbles allocated.

The formula for memory calculation of the COMP-3 data item which declared with N bytes is

	No. of Bytes occupied = (n + 1)/2.

PICTURE clause required for COMP-3 declaration.


Practicle Example:

Differences between COMP & COMP-3:


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


COBOL COMP-2 COBOL Programming Construction

Advertisements