Chapter 33: Financial Calculations in COBOL -- Further Reading
Books
"Murach's Mainframe COBOL" by Mike Murach and Associates The section on decimal arithmetic and the COMPUTE statement is one of the best available treatments of how COBOL handles financial calculations. The book demonstrates packed decimal (COMP-3) arithmetic with detailed examples showing how intermediate precision affects results. The chapter on editing and formatting monetary output for reports is equally valuable. Available from the Murach website and major technical booksellers.
"Numerical Methods in Finance with C++" by Maciej J. Capinski and Tomasz Zastawniak While this book uses C++, the mathematical foundations of financial calculations -- present value, future value, annuities, amortization, and bond pricing -- are language-agnostic and translate directly to COBOL implementations. Understanding the underlying mathematics helps COBOL programmers implement these formulas correctly with appropriate precision and rounding. Available through university bookstores and major online booksellers.
"Enterprise COBOL for z/OS: A First Course" by Robert C. Cain Cain's textbook includes practical exercises on financial arithmetic that demonstrate the difference between COMP-3 and binary arithmetic for monetary calculations. The exercises on rounding modes and ON SIZE ERROR handling are particularly well-designed for building correct financial calculation habits. Search for this title through university bookstores or technical publishers.
Online Resources
IBM Enterprise COBOL Language Reference -- COMPUTE Statement The definitive reference for the COMPUTE statement, including all valid arithmetic expressions, the ROUNDED phrase, ROUNDED MODE options (introduced in Enterprise COBOL V5), and the ON SIZE ERROR imperative. The section on intermediate results explains how the compiler determines the precision of intermediate calculations, which is critical for financial accuracy. Search for "Enterprise COBOL Language Reference" on the IBM Documentation website.
IBM Enterprise COBOL Programming Guide -- Arithmetic Operations The programming guide provides practical guidance on choosing between COMP-3, COMP, and DISPLAY numeric for arithmetic performance and precision. It includes a detailed explanation of how the compiler determines the number of decimal places in intermediate results and how the ARITH(EXTEND) compiler option increases intermediate precision. Available on the IBM Documentation portal.
GnuCOBOL Programmer's Guide -- Numeric Data and Arithmetic For programmers working with GnuCOBOL on open-source platforms, this guide covers how GnuCOBOL implements decimal arithmetic, including differences from IBM Enterprise COBOL in intermediate result precision and rounding behavior. Important reading for anyone developing or testing financial calculations outside the mainframe environment. Available through the GnuCOBOL project documentation pages.
IBM Documentation
IBM Redbook: "Financial Transaction Processing on z/OS" This Redbook covers the architecture of financial transaction processing systems on IBM mainframes, including how packed decimal arithmetic is implemented in hardware, performance considerations for high-volume financial calculations, and best practices for ensuring arithmetic accuracy. It provides context for why COMP-3 is the standard for financial data on z/OS. Search for this title on the IBM Redbooks website.
"Enterprise COBOL V6 Performance Tuning Guide" This guide includes a section on optimizing arithmetic operations, comparing the performance of COMP-3, COMP, and DISPLAY numeric fields in COMPUTE statements. For financial batch programs that process millions of calculations per run, understanding these performance characteristics can significantly reduce batch window times. Available on the IBM Documentation portal.
Standards and Specifications
ISO/IEC 1989:2023 -- COBOL Standard, Arithmetic Section The current COBOL standard specifies the rules for decimal arithmetic, intermediate result precision, rounding modes (including NEAREST-EVEN for banker's rounding), and SIZE ERROR handling. The standard defines the minimum precision requirements that all conforming implementations must meet. Available for purchase through ISO or national standards bodies.
IEEE 754-2019 -- Floating-Point Arithmetic Standard While COBOL deliberately avoids floating-point for financial calculations, understanding IEEE 754 helps programmers explain to stakeholders why floating-point is unsuitable for monetary computation. The standard documents the representation errors that make 0.1 + 0.2 not exactly equal to 0.3 in binary floating-point. Available through the IEEE Standards Association.
"Day Count Conventions" -- ISDA Documentation The International Swaps and Derivatives Association publishes the authoritative definitions of day-count conventions (Actual/360, Actual/365, 30/360, and others) used in interest calculations worldwide. Understanding these conventions is essential for implementing correct interest accrual programs. Available through the ISDA website and financial industry reference materials.
"Truth in Lending Act (Regulation Z) -- Annual Percentage Rate Computation" The Federal Reserve's Regulation Z specifies how Annual Percentage Rate (APR) must be calculated and disclosed for consumer credit products. The appendix to Regulation Z contains the mathematical formulas and the actuarial method that COBOL programs must implement when generating truth-in-lending disclosures. Available through the Federal Reserve and Consumer Financial Protection Bureau websites.