PACKED-DECIMAL (COMP-3)

In IBM® Enterprise COBOL Version 4 Release 2 Performance Tuning, it says: "When using PACKED-DECIMAL (COMP-3) data items in computations, use 15 or fewer digits in the PICTURE specification to avoid the use of library routines for multiplication and division".

Using V6 and the options ARCH(8 | 9 | 10 | 11) and OPT(1 | 2), the compiler can generate inline decimal floating-point (DFP) code for some of these larger multiplication and division operations. The maximum intermediate result size supported for this optimization is 34 digits. Although there is some overhead in this conversion to DFP, it is less of a penalty than having to invoke a library routine. This is also true for external decimal (DISPLAY and NATIONAL) types that are converted by the compiler to packed decimal for COMPUTE statements.

Using V6.2 and ARCH(12), the compiler instead uses the vector packed-decimal facility, which accelerates packed and zoned decimal computation by storing intermediate results in vector registers instead of in memory. This avoids the overhead of conversion to DFP.