Skip to main content

Packed Decimal

  • March 20, 2016
  • 2 replies
  • 0 views

What is the purpose of packed decimal field and is it necessary with Visual Cobol?  I have researched and cannot find any pros or cons on its use with Visual Cobol.  


#COBOLVISUALCOBOLMIGRATION

2 replies

Michael Polinske

What is the purpose of packed decimal field and is it necessary with Visual Cobol?  I have researched and cannot find any pros or cons on its use with Visual Cobol.  


#COBOLVISUALCOBOLMIGRATION

Packed decimal in Visual Cobol is so that it is compatible with mainframe Cobol.


What is the purpose of packed decimal field and is it necessary with Visual Cobol?  I have researched and cannot find any pros or cons on its use with Visual Cobol.  


#COBOLVISUALCOBOLMIGRATION

Packed-decimal is a feature of standard COBOL; see e.g. ISO/IEC 1989:2002 (the 2002 version of the international COBOL standard) item 13.16.58.3 #10. It's not present simply for mainframe compatibility; it's a required part of the standard language.

Packed-decimal support has been in the COBOL standard since 1985, and before standardization as the (still-supported) COMPUTATIONAL-3 (aka COMP-3) usage, which was introduced by IBM but widely supported by other vendors. It dates back to the 1960s.

It's widely used in COBOL programs. As a member of the BCD (Binary-Coded Decimal) family of numeric encodings, it uses radix 10 to represent integers and fixed-point rationals. That means it has the property of rounding and truncating precision just as decimal numbers do with pen-and-paper arithmetic. That's very important for financial applications, which have both practical and legal reasons for adhering to decimal arithmetic.

Various online references discussing BCD have more information.