Problem With Obscure “P” (Scaling) Picture Symbol in Packed Decimal

The development of the Camelian GnuCOBOL Debugging Extensions has uncovered problems in GnuCOBOL’s handling of the P scaling character in PICTURE strings for PACKED DECIMAL (COMP-3 and COMP-6) variables. This is an OBSCURE capability originally introduced to save a few bytes of storage for numbers in the thousands, millions, thousandths, millionths, etc. Where the numeric-edited value correctly uses P, the positions containing the P character(s) is supposed to ALWAYS be ZERO.

At present, in certain cases, GnuCOBOL stores incorrect data into the underlying storage location of variable. That data is then is neither stored on output or displayed correctly. In some cases, displayed values are truncated do to NULL characters (x”00”) in storage.