Chapter 22: Embedded SQL and DB2 Fundamentals -- Further Reading
Books
"DB2 for z/OS: A COBOL Programmer's Reference" by Joanne Minich This book is written specifically for COBOL programmers learning DB2, which makes it an ideal companion to this chapter. It covers host variable declaration, DCLGEN usage, SQLCA interpretation, and cursor processing with extensive COBOL code examples. The troubleshooting section catalogs common SQLCODEs with their causes and solutions in a COBOL context. Search for this title through technical publishers and major online booksellers.
"Murach's Mainframe COBOL" by Mike Murach and Associates The DB2 chapters in Murach's text provide an exceptionally clear introduction to embedded SQL in COBOL, with side-by-side presentations of the SQL statement and the surrounding COBOL code. The treatment of the precompile-compile-bind process is accompanied by annotated JCL examples that show exactly how each step works. The progressive build-up from singleton SELECT to cursor processing is well-paced for newcomers. Available from the Murach website and major technical booksellers.
"DB2 Developer's Guide" by Craig S. Mullins Mullins' comprehensive DB2 reference covers embedded SQL for COBOL in depth, including host variable type mapping, indicator variables, cursor types, and the BIND process. While the book covers DB2 from multiple language perspectives, the COBOL-specific sections are thorough and include production-quality code patterns. The chapters on DB2 catalog tables and access path analysis are valuable background for any COBOL-DB2 developer. Available from major technical booksellers.
Online Resources
IBM Db2 for z/OS Application Programming and SQL Guide The definitive guide for embedding SQL in COBOL programs on z/OS. This guide covers host variable declaration rules, DCLGEN usage, SQLCA structure, cursor processing, indicator variables, dynamic SQL, and the full precompile-compile-bind workflow. Every SQL statement's COBOL-specific behavior is documented with examples. Search for "Db2 for z/OS Application Programming and SQL Guide" on the IBM Documentation website.
IBM Db2 for z/OS SQL Reference The SQL reference provides complete syntax and semantics for every SQL statement that can be embedded in a COBOL program. The SELECT, INSERT, UPDATE, DELETE, DECLARE CURSOR, OPEN, FETCH, and CLOSE entries are essential reading for understanding what is valid within EXEC SQL blocks. Available on the IBM Documentation website under Db2 for z/OS publications.
IBM Enterprise COBOL Programming Guide -- Using DB2 The Enterprise COBOL programming guide includes sections specifically on programming with DB2, covering the precompiler interface, compile-time options for DB2, and the relationship between COBOL data types and DB2 column types. This is the reference for understanding the COBOL side of the COBOL-DB2 interface. Find this in the IBM Documentation portal under the Enterprise COBOL Programming Guide.
IBM Documentation
IBM Redbook: "DB2 for z/OS and COBOL: A Practical Approach" This Redbook provides hands-on tutorials for COBOL-DB2 programming, starting with simple SELECT statements and building to complex cursor processing and error handling. The step-by-step JCL examples for precompile, compile, link, and bind are annotated with explanations of each step and its parameters. The troubleshooting chapter covers common SQLCODE values and their resolution. Search for this title on the IBM Redbooks website.
IBM DCLGEN Reference in Db2 for z/OS Utility Guide The DCLGEN utility documentation explains how to generate COBOL host variable declarations from DB2 table definitions, including the options for controlling field naming, null indicator generation, and output format. Understanding DCLGEN options helps developers produce clean, maintainable host variable declarations. Available on the IBM Documentation website under Db2 for z/OS Utility Guide and Reference.
IBM Db2 for z/OS Codes Reference This reference catalogs every SQLCODE and SQLSTATE value that DB2 can return, with detailed explanations of causes, user responses, and system programmer responses. The ability to quickly look up an SQLCODE and understand its meaning is essential for debugging embedded SQL programs. Search for "Db2 for z/OS Codes" on the IBM Documentation website.
Standards and Specifications
ISO/IEC 9075 -- SQL Standard (Database Language SQL) The international SQL standard defines the specification for embedded SQL, including the EXEC SQL syntax, host variable conventions, indicator variables, and cursor processing model. While DB2 extends the standard in various ways, understanding the standard SQL foundation helps distinguish portable SQL from DB2-specific extensions. Available for purchase through ISO or national standards bodies.
"SQL Programming for COBOL Developers" -- SHARE Conference Proceedings SHARE presentations on COBOL-DB2 programming provide practical insights from experienced developers and IBM DB2 product specialists. Topics frequently covered include efficient cursor processing patterns, batch SQL optimization, and migration strategies for modernizing embedded SQL in legacy COBOL programs. SHARE proceedings are available through the SHARE association website.