Highlighted
Contributor.
Contributor.
1568 views

Packed Decimal

Jump to solution

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.  

0 Likes
1 Solution

Accepted Solutions
Highlighted
Respected Contributor.
Respected Contributor.

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

View solution in original post

0 Likes
2 Replies
Highlighted
Respected Contributor.
Respected Contributor.

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

View solution in original post

0 Likes
Highlighted
Micro Focus Expert
Micro Focus Expert

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.

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.