Chapter 23: Advanced DB2 Programming -- Further Reading
Books
"DB2 Developer's Guide" by Craig S. Mullins Mullins' reference is the most comprehensive single-volume treatment of DB2 for z/OS programming. The chapters on dynamic SQL cover all four forms with detailed COBOL examples, and the performance tuning chapters provide systematic approaches to EXPLAIN analysis, index design, and SQL optimization. The treatment of stored procedures and LOBs reflects production-level complexity. Available from major technical booksellers.
"DB2 for z/OS Stored Procedures: Through the CALL and Beyond" by Terry Purcell and Bonnie Baker This focused text covers everything about DB2 stored procedures from a COBOL perspective, including parameter passing, result set return, nested procedure calls, and debugging stored procedures with IBM tools. The architecture diagrams showing how WLM-managed stored procedure address spaces work are particularly helpful for understanding the runtime environment. Search for this title on the IBM Redbooks website or through technical publishers.
"DB2 SQL Performance Techniques" by Tony Andrews Andrews' book is focused exclusively on writing efficient SQL for DB2 on z/OS. It covers predicate analysis, access path optimization, join strategies, and the effective use of EXPLAIN. While not COBOL-specific, every technique applies directly to the SQL embedded in COBOL programs. The before-and-after SQL examples with EXPLAIN output are invaluable for learning to diagnose and fix performance problems. Available through major technical booksellers.
Online Resources
IBM Db2 for z/OS Application Programming and SQL Guide -- Dynamic SQL The official guide provides comprehensive documentation of all dynamic SQL forms, including EXECUTE IMMEDIATE, PREPARE/EXECUTE, dynamic cursors with the SQLDA, and the interaction between dynamic SQL and DB2 packages. The rules for parameter markers and the behavior of dynamic COMMIT points are precisely documented. Search for "Db2 for z/OS Application Programming and SQL Guide" on the IBM Documentation website.
IBM Db2 for z/OS Application Programming and SQL Guide -- LOBs The LOB programming sections document how to declare LOB host variables and locators in COBOL, handle LOB retrieval and storage, and manage the memory implications of large LOB columns. The guidance on when to use locators versus materialized variables is essential for production applications. Available on the IBM Documentation website under the Application Programming guide.
IBM Db2 for z/OS Managing Performance Guide This guide covers DB2 performance management from the application programming perspective, including EXPLAIN analysis, access path interpretation, RID pool utilization, and workload management. The sections on batch performance tuning are particularly relevant for COBOL programs that process large volumes of data through embedded SQL. Search for "Db2 for z/OS Managing Performance" on the IBM Documentation website.
IBM Documentation
IBM Redbook: "DB2 for z/OS: Enhancing COBOL Application Performance" This Redbook provides detailed case studies of COBOL-DB2 performance optimization, including multi-row FETCH implementation, dynamic statement caching, package rebind strategies, and parallelism enablement. Each case study includes before-and-after measurements that quantify the performance improvements achieved. Search for this title on the IBM Redbooks website.
IBM Redbook: "Stored Procedures, Triggers, and User-Defined Functions on DB2 for z/OS" This comprehensive Redbook covers the creation, deployment, and management of DB2 stored procedures written in COBOL and other languages. The chapters on COBOL stored procedures include complete source code examples, WLM configuration guidance, and debugging techniques. The discussion of result set processing from the calling program's perspective is particularly valuable. Search for this title on the IBM Redbooks website.
IBM Db2 for z/OS EXPLAIN Reference The EXPLAIN reference documents how to capture and interpret access path information for SQL statements. Understanding EXPLAIN output is essential for tuning the SQL in COBOL programs. The reference covers PLAN_TABLE columns, access methods (tablespace scan, index scan, list prefetch), join methods (nested loop, merge scan, hybrid), and sort operations. Available on the IBM Documentation website.
Standards and Specifications
ISO/IEC 9075 -- SQL Standard, Dynamic SQL and Scrollable Cursors The SQL standard defines the specifications for dynamic SQL statements, scrollable cursors, and multi-row operations. DB2 implements these standard features with some extensions. Understanding the standard helps developers write more portable SQL and distinguish standard behavior from DB2-specific extensions. Available for purchase through ISO or national standards bodies.
"Advanced DB2 Programming Patterns" -- SHARE Conference Proceedings SHARE presentations on advanced DB2 programming provide insights from IBM DB2 developers and experienced practitioners. Topics include dynamic SQL security patterns, stored procedure design best practices, LOB management strategies, and multi-row processing optimization. These presentations often preview upcoming DB2 features and provide early guidance on adoption. Available through the SHARE association website.