My Cart (0)

Customer Service 1-800-221-5528

DB2 for the COBOL Programmer, Part 1

by Curtis Garvin and Steve Eckols
15 chapters, 431 pages, 182 illustrations
Published 1999
ISBN 978-1-890774-02-8
Print: $36.00
List Price: $45.00 Save 20%
eBook: $28.00
List Price: $35.00 Save 20%
Print + eBook: $44.00
List Price: $55.00 Save 20%

This is the latest edition of our classic DB2 book. Since the first edition of this book came out in 1991, more than 150,000 COBOL programmers have learned DB2 from it. In fact, this book in combination with our COBOL, CICS, and JCL books are four of the all-time, best-selling mainframe books.

Although this book was published in 1999, trainers at mainframe shops tell us that much of the DB2 programming is still being done the way it's presented in this book. One reason for this is that IBM has always prided itself on the upward-compatibility of its software.

Incidentally, this is the first mainframe book we developed with our "paired pages" format. It is also one of the last books that we published before we went to blue covers with Murach's as part of the title. But if you've ever used any of our Murach's books, you can count on this book to deliver the same level of practical, example-packed training...even though the cover is different!

College Instructors

Go to our instructor’s site to learn more about this book and its instructor’s materials.

I have all but 4 or 5 of your books and find you have outdone yourself with the Second Edition of DB2, Part 1. This is the most organized and easily understood book I have read on DB2 in the past 10 years, including your previous edition. I highly recommend it for all levels of expertise."

K.C. Roth, Allentown, Pennsylvania

  • About this Book
  • Table of Contents
  • FREE Downloads
  • Corrections
  • Reviews

Who this book is for

This book assumes that you already have COBOL experience or at least have taken a first course in COBOL.

If you have any doubts about your COBOL skills, you may want to get a copy of Murach’s Mainframe COBOL. It teaches all of the COBOL skills that are used in this book; it is a terrific desk reference; and it is the perfect companion to this DB2 book.

What you’ll learn in this book

DB2 is the primary database management system (DBMS) for IBM mainframe computers that run under the z/OS operating system and its predecessors. Although you can use several different methods to work with DB2 databases, most DB2 work is done through COBOL programs. That’s why the goal of this book is to show you how to develop and maintain those COBOL programs.

Specifically, this book teaches you how to use Structured Query Language (SQL) within a COBOL program to retrieve and update data stored in DB2 databases. To make that manageable, this book is divided into three sections.

Section 1: The basics of DB2 programming in COBOL

To get you started right, this section consists of four chapters:

  • Chapters 1 and 2 show you how to retrieve data from a single DB2 table.
  • Chapter 3 shows you how to add rows to, delete rows from, and update rows in a single table.
  • Chapter 4 shows you how to retrieve data from two or more related tables at the same time by using unions and joins.

When you complete this section, you’ll be able to write production COBOL programs that access and update DB2 data.

Section 2: Other programming essentials

In this section, each of the seven chapters lets you expand your basic skills so you can process DB2 data with more expertise. For instance:

  • Chapter 6 shows you how to use the column functions to summarize or average the data in one column of a table.
  • Chapter 8 shows you how to work with variable-length columns and nulls.
  • Chapter 11 shows you how to maximize locking efficiency so your programs don’t tie up the system.

In this section, each chapter is written as an independent unit, so you can read the chapters in whatever sequence you prefer.

Section 3: Program development skills

In this section, you’ll learn the skills you need for binding, precompiling, compiling, link editing, and testing your COBOL programs:

  • Chapter 12 shows how to use DB2I, which is a development tool for preparing and running DB2 programs interactively.
  • Chapter 13 shows how to do these programming tasks in batch, without using DB2I.
  • Chapter 14 shows how to use SPUFI, a DB2I facility, for testing SQL statements and creating test tables.
  • Chapter 15 shows how to use the Query Management Facility (QMF) to add data to the test tables you create with SPUFI.

You can read the chapters in this section any time after you complete chapter 1.

Why you’ll learn faster and better

  • This is the only DB2 book written for COBOL programmers. In contrast, most other DB2 books focus on database administration or ad hoc processing to the exclusion of many of the DB2 essentials for COBOL programming.
  • When you complete section 1 of this book...just 142'll be a competent, beginning DB2 programmer. You'll be developing COBOL programs that access, add, delete, or update the data in one or more DB2 tables...and you'll understand how DB2 works.
  • To help you learn more easily, this book presents 12 complete COBOL programs that work with DB2 databases. These programs let you see how the DB2 code you're learning fits in with your COBOL code. And once you've used these programs for training, they become time-saving models for the programs you develop or maintain on the job.

What versions of DB2 this book teaches

Although the programs in this book were tested with DB2 version 4.1, this book teaches the DB2 essentials that don't change much from one version of DB2 to the next. As a result, you should be able to use all the skills that you learn in this book with any version of DB2. Although newer releases have some enhancements to DB2...especially performance enhancements...everything in the earlier releases should still work.

Of course, this assumes that you have access to an IBM mainframe that uses DB2 as its database management system. That means that this book is best used in a training program or environment that gives you access to an IBM mainframe. If you don't have access to an IBM mainframe, you can still use this book to learn how to write COBOL/DB2 programs. You just won't be able to practice what you've learned until you're on the job.

Companion books

Murach’s Mainframe COBOL

Since this DB2 book assumes that you know how to develop COBOL programs on an IBM mainframe, Murach’s Mainframe COBOL is the ideal companion book.

Beyond that, though, there’s a lot more to learn to be an effective DB2 programmer. Depending on your assignments, then, some of our other mainframe books may be useful, and all of them work in combination with our COBOL and DB2 books:

DB2 for the COBOL Programmer, Part 2

Part 1 is just the first book in our two-part DB2 series. To take your skills to the next level, you can get Part 2 in this series (available only as an eBook).

Murach’s CICS for the COBOL Programmer

This book shows you how to write interactive COBOL programs using the Customer Information Control System (CICS), which is IBM’s world-class transaction processor. Often, in fact, mainframe applications use a combination of COBOL, CICS, and DB2.

Murach’s OS/390 and z/OS JCL

This book presents the background skills that every programmer needs for working with an IBM mainframe. That includes using the operating system’s JCL (Job Control Language), working with VSAM files by using AMS (Access Method Services), and much more.

MVS TSO, Part 1

MVS TSO, Part 2

Part 1 of this series shows how to use the ISPF text editor to develop your programs. Part 2 presents the TSO commands that underlie ISPF and shows you how to use these commands on their own and in CLIST and REXX procedures.

To view the table of contents for this book in a PDF, just click on the link below:

Table of Contents

The programs in the book

This download gives you the code for the 12 programs that are presented in the book, along with the JCL, SQL, CLIST, and PROC you need to compile and run the programs. It also contains a Readme.txt file that summarizes what files are included and how to use them.

Self-extracting Zip file (48Kb) Download Now

Corrections to Chapter 2

Pages 66-69

If an SQLCODE other than 0 or 100 is encountered when a row is fetched in module 170 of the sales inquiry program, the current code in that module does not end the PERFORM 160 loop in module 140 that gets invoice information UNTIL END-OF-INVOICES. You can correct this problem using one of two techniques. First, you can add another condition to the PERFORM 160 statement so it looks like this:

db1r 1

You can also correct this problem by modifying the error checking code in module 170 like this:

db1r 2

If you make this change, you can also remove the IF VALID-CURSOR statement from module 160, since the END-OF-INVOICES condition in that module will always be true if the cursor is not valid.

Correction to Chapter 3

Page 99

In module 000 of the enhanced update program, the SQLCODE is displayed if an error occurs during the processing of a transaction and the unit of work must be rolled back. The intent was to display the SQLCODE from the SQL statement that caused the error. But because the ROLLBACK statement in module 200 is executed before the SQLCODE is displayed, the SQLCODE from the ROLLBACK statement is displayed instead. The easiest way to correct this problem is to move the statement that displays the SQLCODE in module 000 before the PERFORM statement for module 200.

There are no reviews for this product yet.

To leave a review, please log in to your account.     Log In Here

Our Ironclad Guarantee

You must be satisfied. Try our books for 60 days. They must be the best you've ever used or send them back for a prompt refund. No questions asked!

Contact Murach Books

For orders and customer service:


Weekdays, 8 to 4 Pacific Time

College Instructors

If you're a college instructor who would like to consider a book for a course, please visit our website for instructors to learn how to get a complimentary review copy and the full set of instructional materials.