DB2 for z/OS SQL & Application Programming (DB1010)

Request a Quote for this class

About this Course

DB2 SQL and Application Programming is a 5 day course targeting the needs of programmers and developers writing applications that access data stored in the DB2 environment.

The presentation is an integrated mixture of lecture and workshop activities that introduce and reinforce the basic techniques and approaches to relational database technology as implemented in DB2. Topics covered include structure and manipulation of DB2 data, operational considerations in both on-line and batch environments; integrity; embedded programming techniques and preparation; and an introduction to performance analysis.

Material comprising the course is consistent with DB2 for z/OS Version 9. The workshop activities follow the classroom material and are designed for both topic reinforcement and practice. Programming topics are supported by workshops in both the on-line and batch environment, this includes precompiling, compiling, linking, and the various options of the DB2 BIND.

Audience Profile

Programmers, application developers and computer analysts who are exposed to, or are required to perform the activities associated with application development and implementation in a DB2 environment.

At Course Completion

Upon successful completion of this course, the student will be able to:

  • Describe the overall purpose of, and the approaches to manipulating data in a database management system.
  • Describe the major objects used by DB2 for data manipulation.
  • Translate and code business problems in Structured Query Language.
  • State the internal approaches utilized by DB2 for accessing data.
  • List the features of DB2 for z/OS Version 9.
  • Describe the major objects used by DB2 for data manipulation.
  • Embed SQL in COBOL programs.
  • Prepare COBOL programs containing embedded SQL statements for execution in the z/OS batch environment.
  • Process multi-row tables with DB2 cursors.
  • State the internal approaches utilized by DB2 for accessing data.

Prerequisites

Basic programming skills in the COBOL environment and familiarity with the z/OS environment and TSO/ISPF.

Course Outline

1. Relational Database Concepts

  • The Relational Model
  • Domains
  • Integrity and Relationships
  • Structured Query Language (SQL)
  • Unknown Values (NULL)
  • Basic Datatypes

2. Basic Data Manipulation

  • SELECT Statement
  • Using SELECT
  • Projecting Columns Onto the Result
  • Basic Predicates
  • Expressions in the SELECT Clause
  • Expressions in the WHERE clause

3. Intermediate Data Manipulation

  • Compound Conditions
  • Other WHERE Clause Operators
    • BETWEEN
    • IN
    • LIKE
    • IS NULL
  • Using DISTINCT
  • ORDER BY Clause

4. Built-in Functions

  • Working with Datatypes and Casting
  • Functions Involving NULLs
  • CASE Statements

5. Aggregation

  • SUM, AVG, MIN, MAX & COUNT Functions
  • Grouping Results with GROUP BY
  • Filtering Groups with HAVING

6. Joins

  • Inner Equi-Join
  • Join Classification
  • Cartesian Products
  • Inner Joins of More than 2 Tables

7. Data Modification

  • INSERT
  • UPDATE
  • DELETE
  • COMMIT and ROLLBACK

8. Complex Joins

  • LEFT / RIGHT / FULL Outer Joins
  • Self-Joins

9. SQL Subqueries

  • Non Correlated Subqueries
  • Correlated Subqueries
  • Scalar Fullselects

10. Set Operations

  • Union / Union ALL
  • Intersect / Intersect ALL
  • Except / Except ALL

11. DB2 on the z/OS Platform

  • The DB2 Family
  • The DB2 Environment on z/OS
  • Stored Procedures
  • Databases and Schemas
  • Tablespaces
  • Indexes
  • The DB2 Catalog
  • Structured Query Language

12. Introduction to Embedded SQL

  • Program Preparation Overview
  • SQL Program Development Steps
  • Retrieving Data with SELECT … INTO
  • Indicators in UPDATE and INSERT
  • The SQL Communications Area
  • SQLCODE and SQLSTATE
  • Error Handling

13. Program Preparation

  • Program Preparation Steps
  • DCLGEN
  • Program Preparation with Precompiler
  • Program Preparation with Coprocessor
  • The TSO Terminal Monitor Program
  • The DSN RUN Subcommand
  • TSO Batch Attachment
  • Program Execution
  • Multi-Threaded Attach
  • BIND
  • Debugging
  • Generated Code
  • Catalog Tables for Packages and PLANs

14. Cursors

  • Cursor Processing Overview
  • DECLARE Cursor
  • OPEN Cursor
  • FETCH
  • CLOSE Cursor
  • A Complete Example
  • Positioned UPDATE and DELETE
  • Updating with a Read-Only Cursor
  • Logical Unit of Work Overview
    • COMMIT
    • ROLLBACK and SAVEPOINT
    • Two-Phase Commit Protocol

15. Performance

  • The DB2 Optimizer
  • Tuning SQL
  • Access Path Choices
  • Index Processing
  • Prefetch
  • Predicate Evaluation
  • Coding SQL for Performance