matthewstorey.co.uk
In this section Binary Coded Decimal | Binary | Character Numeric Edited | Packed Decimal | Text | Zoned Decimal

Binary Coded Decimal

About

Stores a number using the binary representation of the value 0 - 9. '+' signs are encoded as 'E' (14) and '-' signs are encoded as 'F' (15).

Limits

COBOL programs can only handle a maximum of 18 digits by default, although this can be extended to 31 via the 'ARITH(EXTEND)' compiler option.

Other

Also known as 'BCD'.

Implied decimal places.

Use

Used on every platform.

Examples

Unsigned

     12345     is encoded in hex as    00000
                                       12345

     12345.67  is encoded in hex as    0000000
                                       1234567
      

Signed

     +12345    is encoded in hex as    000000
                                       E12345

     -12345.67 is encoded in hex as    00000000
                                       F1234567
      

Back to top