DISPLAY
In IBM® Enterprise COBOL Version 4 Release 2 Performance Tuning, it says: "Avoid using USAGE DISPLAY data items for computations (especially in areas that are heavily used for computations)". This continues to be the best practice in V6. However, using the options OPT(1 | 2) and ARCH(10 | 11) enables the V6 compiler to efficiently convert DISPLAY operands to Decimal Floating Point (DFP). At ARCH(12) and above, using OPT(1 | 2) enables the V6 compiler to convert DISPLAY operands to PACKED-DECIMAL, carrying out PACKED-DECIMAL arithmetic in vector registers. Both optimizations reduce the overhead of using DISPLAY data items in computations.
1 A pic s9(17).
1 B pic s9(17).
1 C pic s9(18).
To COMP-3:1 A pic s9(17) COMP-3.
1 B pic s9(17) COMP-3.
1 C pic s9(18) COMP-3.
ADD A TO B GIVING C.
In
V4 using COMP-3 is 22% faster than using DISPLAY, while in V6 using
COMP-3 is 27% faster than using DISPLAY.Although performance comparisons will vary for different sizes of data and different types of computational statements the performance of DISPLAY data items in computations has generally improved in V6 when using ARCH(10 | 11) and OPT(1 | 2), or when using ARCH(12) or higher. Despite the improvements between V6 and V4, it is still recommended to use COMP-3 or BINARY for data items that will be used in computations. In particular, if a data item will be used as a loop counter or a table index, converting that data item from DISPLAY to BINARY can lead to significant performance gains.