Chapter 6: Further Reading -- Arithmetic Operations and Numeric Processing
Books
"Murach's Mainframe COBOL" by Mike Murach & Associates The arithmetic chapters in this book provide one of the clearest treatments of all five COBOL arithmetic verbs, with side-by-side examples showing each form (TO/FROM/BY, GIVING, CORRESPONDING) and their precise semantics. The coverage of ON SIZE ERROR is especially practical, with real-world examples demonstrating both overflow detection and division-by-zero handling. The ROUNDED phrase and its interaction with different USAGE types are explained with concrete before-and-after values. Available from the publisher and major booksellers.
"COBOL for the 21st Century" by Nancy Stern, Robert A. Stern, and James P. Ley This textbook devotes exceptional attention to decimal alignment and truncation rules, walking through the mechanics of how COBOL aligns operands with different decimal positions before performing arithmetic. The progressive exercises build from simple ADD/SUBTRACT through complex COMPUTE expressions, with each exercise requiring the reader to predict the exact result -- an invaluable practice for mastering COBOL arithmetic. The coverage of intermediate result precision is more thorough than most introductory texts. Published by Wiley.
"Decimal Arithmetic" by Mike Cowlishaw The definitive technical work on why decimal arithmetic matters for financial computing. Cowlishaw, the architect of the IEEE 754-2008 decimal floating-point standard, explains in rigorous detail how binary floating-point introduces errors in decimal calculations, why packed decimal avoids these errors, and the mathematical foundations of different rounding modes (including banker's rounding). While not COBOL-specific, this work provides the theoretical foundation for understanding why COBOL's COMP-3 and ROUNDED phrase exist. Available through the author's site at speleotrove.com.
"Financial Calculations in COBOL" (IBM Redbooks) IBM Redbooks include several publications focused on financial calculation patterns in COBOL, covering compound interest, amortization schedules, present value calculations, and tax bracket processing. These provide production-quality code examples with proper COMP-3 declarations, comprehensive ON SIZE ERROR handling, and field sizing guidelines derived from decades of mainframe financial system development. Search for "IBM Redbooks COBOL financial" on the IBM Redbooks website.
Online Resources
GnuCOBOL Programmer's Guide -- Arithmetic Statements Chapter The GnuCOBOL documentation provides detailed information on arithmetic statement behavior specific to the GnuCOBOL compiler, including supported ROUNDED MODE options, intermediate result precision, and the interaction between COMPUTE and different USAGE types. It also documents any differences from IBM Enterprise COBOL behavior, which is important for programmers developing on GnuCOBOL with the intention of deploying to mainframes. Available on the GnuCOBOL project site at SourceForge.
"COBOL Arithmetic Tutorial" (Mainframes.com, Tutorialspoint, and similar sites) Several tutorial sites maintain comprehensive pages on COBOL arithmetic verbs, complete with worked examples showing input values, PICTURE clauses, and exact output. These are useful for quick reference and for testing your understanding of edge cases like division by zero, unsigned negative results, and the difference between INTO and BY. Search for "COBOL DIVIDE INTO BY difference" or "COBOL arithmetic tutorial" for current resources.
"What Every Computer Scientist Should Know About Floating-Point Arithmetic" by David Goldberg This seminal paper, originally published in ACM Computing Surveys, explains the fundamental limitations of binary floating-point representation. While highly technical, the sections on decimal-to-binary conversion errors and accumulated rounding bias are directly relevant to understanding why COBOL uses packed decimal instead of floating point for financial data. The paper explains in mathematical terms what COBOL programmers observe in practice: that COMP-1 and COMP-2 must never be used for money. Available freely through various academic and computing websites -- search for the exact title.
IBM Documentation
"Enterprise COBOL for z/OS: Language Reference" -- Arithmetic Statements Chapter (IBM publication) The Language Reference provides the authoritative specification for all five arithmetic verbs on IBM platforms, including the precise semantics of INTO versus BY, the order of evaluation in COMPUTE expressions, the behavior of ROUNDED with different USAGE types, and the conditions that trigger ON SIZE ERROR. The section on intermediate result computation (Appendix A in some editions) is particularly important -- it documents the exact formula IBM uses to determine the precision of intermediate results in COMPUTE expressions. Search for publication SC27-1408 on the IBM Knowledge Center.
"Enterprise COBOL for z/OS: Programming Guide" -- Arithmetic Chapter (IBM publication) The Programming Guide goes beyond syntax to explain practical arithmetic programming on IBM mainframes. It covers the ARITH(EXTEND) compiler option (which provides up to 31-digit intermediate precision), performance implications of COMP-3 versus COMP versus DISPLAY in arithmetic, and techniques for avoiding common precision pitfalls. The section on fixed-point arithmetic versus floating-point arithmetic provides guidance on when COMPUTE with exponentiation switches to floating-point internally. Search for SC27-1412 on the IBM Knowledge Center.
"Enterprise COBOL: Performance Tuning" -- Arithmetic Performance (IBM publication) This guide documents the performance characteristics of different arithmetic operations on z/Architecture hardware. It explains why COMP-3 arithmetic is fast on mainframes (native packed-decimal hardware instructions AP, SP, MP, DP, ZAP), why mixing USAGE types in a single arithmetic statement causes conversion overhead, and how to structure calculations for optimal performance. The benchmarks comparing COMP-3, COMP, and DISPLAY arithmetic provide concrete data for making USAGE decisions. Available on the IBM Knowledge Center.
Standards and Historical References
ISO/IEC 1989:2014 -- Section 14.8: Arithmetic Statements The official COBOL standard defines the portable behavior of all arithmetic verbs, including decimal alignment rules, intermediate result precision requirements, ROUNDED MODE semantics, and the exact conditions that constitute a size error. The standard is the authoritative source for resolving ambiguities between compiler implementations, particularly regarding ROUNDED MODE behavior (which varies across compilers). Section 14.8.8 on COMPUTE expression evaluation order and intermediate precision is especially important for complex financial formulas. Available for purchase from ISO.
"Packed Decimal Arithmetic on IBM System/360 and z/Architecture" (IBM Systems Journal and technical manuals) The IBM Systems Journal has published several papers on the design and implementation of packed decimal arithmetic in IBM hardware, from the original System/360 through modern z16 processors. These explain why packed decimal became the standard for financial computing on mainframes -- the hardware was specifically designed to execute decimal arithmetic efficiently, creating a virtuous cycle where COBOL programs using COMP-3 ran faster on IBM hardware than equivalent binary arithmetic. Understanding this hardware-software co-design explains a significant part of COBOL's dominance in financial systems. Search the IBM Systems Journal archives or IBM technical references for packed decimal architecture documentation.
"Rounding in Financial Calculations" (regulatory and accounting standards publications) Various financial regulatory bodies (SEC, Federal Reserve, FASB, IFRS) publish guidance on acceptable rounding methods for financial calculations. These documents explain when banker's rounding (NEAREST-EVEN) is required, when truncation is acceptable, and the audit implications of different rounding choices. While not COBOL-specific, they provide the business context that drives COBOL rounding decisions. Search for "rounding rules financial regulations" or consult your organization's accounting standards documentation.