Manta alt

YOUR IBM i TRAINING SOURCE

You must allow the browser to execute JavaScript programs if you want to view product information. If your browser is set up to execute JavaScript programs, the problem is that the product ID was incorrect. Use the menu bar above to find the desired product.

Overview

This course describes how to create an RPG SQL application.

The course begins by describing the coding requirements for embedding SQL statements in an RPG program. This includes a discussion on how to detect and handle errors that occur during the processing of an SQL statement. The course then describes the CL commands used to compile an RPG program which includes embedded SQL statements.

Next, the course describes how to use an SQL cursor to access the records returned by a query and how to develop an application that executes SQL statements dynamically. This is followed by a description of the SQL statements used to support commitment control.

The course ends with a discussion of SQL application performance and optimization.

Approximate Study Time: 3 hours

Objectives

After completing this course, you should be able to:

  • Code an RPG program with embedded SQL statements
  • Detect and handle errors that occur during the processing of an SQL statement
  • Use the SQLRPGLE and SQLRPG commands to compile a program with embedded SQL statements
  • Use Program Development Manager (PDM) to compile a program with embedded SQL statements
  • Code the SQL statements used to define and manipulate an SQL cursor
  • Code an RPG program that executes a dynamic SQL statement
  • Use SQL statements to perform commit and rollback operations
  • Optimize an SQL application

Topic Outline

Embedding SQL Statements in an RPG Program

Compiling a Program with Embedded SQL Statements

Using an SQL Cursor to Process Multiple Rows

Developing a Dynamic SQL Application

SQL and Commitment Control

Performance and Optimization Considerations

Audience

This course is intended for RPG programmers who will be developing SQL applications.

Prerequisites

This course assumes that you have a basic knowledge of DB2. You can satisfy this prerequisite by successfully completing the course Introduction to DB2. It also assumes that have a basic knowledge of SQL and can code SQL statements. You can satisfy this prerequisite by successfully completing the first course in this series, SQL Fundamentals. Finally, the course assumes that you are an experienced RPG programmer. If you are not familiar with both OPM and ILE program development procedures, it is recommended that you also take The IBM i Programming Environment series.