GnuCOBOL Knowledge Base

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

A technical note on GnuCOBOL handling of the P scaling character in packed-decimal variables.

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.

← Back to GnuCOBOL Knowledge Base

Proven ExperienceDecades of real-world COBOL expertise.
Reliable SolutionsBuilt for stability, performance, and longevity.
Trusted PartnerWe become an extension of your team.
Focused on ResultsYour systems. Your goals. Our commitment.