Back to Courses

Db2 13 – Creating and Maintaining Db2 Programs

Duration

5 hours

Overview

Description

The Create and Maintain Db2 Programs course describes how SQL can be invoked from an application program and the interaction that can occur between the application program and Db2. Measuring the success of the SQL is then discussed, and the use of SQLCA, and SQLSTATE to determine this. You will then see how cursors can be used to reference table data, and finally how Db2 data is saved and recovered using commits and rollbacks.

Audience

Programmers and DBAs requiring training in writing application programs to reference and update Db2 data, particularly in the z/OS environment.

Prerequisites

Successful completion of the Db2 13 – Introduction to Db2 course.

Objectives

After completing this course, the student will be able to:

  • Describe how SQL can be embedded in an application program
  • Determine the success of SQL execution using SQLCODE and SQLSTATE
  • Describe the steps required when using cursors to reference table data
  • Define a Db2 rollback

Course Content

Embedding SQL in an Application Program

Application Preparation Process
Embedding SQL
Advantages of a Bind
Db2 Precompiler
Plans and Packages

Manipulating Data and Components of an Application Program

Codes Returned from Db2 to an Application Program
Utilizing SQLCA
SQL return code – SQLSTATE
Declaring Table and View Definitions
Passing Values between an Application Program and Db2 Using Host Variables
Null Values
Indicator Variables

Using Cursors to Reference Table Data

Types of Cursors
Declaring a Cursor
Opening and Closing the Cursor
Scrollable Cursors
Fetching Data Using a ROWSET-Positioned Cursor
Benefits of Using ROWSET
Determining Cursor Attributes

Commits and Savepoints

Initiating a Commit Point
Code used to Commit Data
Commit Processing
Db2 Rollback Process
Forcing a Rollback
Defining a Savepoint

Db2 13 – Creating and Maintaining Db2 Programs Mastery Test