Skip to main content

 
IBM Power Systems software  >  IBM i  > Software  > 

IBM DB2 for i

  
OverviewKey BenefitsGetting StartedProductsSupport

Coding examples
This web page contains small programs that are furnished by IBM as simple examples to provide an illustration. These examples have not been thoroughly tested under all conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these programs. All programs contained herein are provided to you “AS IS”. THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE EXPRESSLY DISCLAIMED.

QSQPRCED API (SQL Extended Dynamic)
DB2 for i Blocked Insert Examples (ODBC/CLI & VB)
Sample Database for DB2 for i
Database Monitor Status Checker
Database Memory Monitor Commands (ZIP, 395KB)

Coding examples from “DB2 for i SQL Programmer’s Guide”

  C Language Programming Example
  COBOL Language Programming Example
  PL/I Language Programming Example
  RPG Language Programming Example


Stored Procedure Examples

  SQL Stored Procedure with Result Sets
  SQL Stored Procedure – Index Listing Utility

External Procedure (C) – SQL Parameter Style

  Procedure Source Code
  Invoker Source Code

User Defined Function Examples

  Check User authorization UDF (External version)
  Circle Area UDF (SQL & External version)
  Get DB2 for i Table Size (External)
  Index Evaluator UDTF
Index Evaluator UDTF Description
Index Evaluator UDTF Code
Index Evaluator UDTF Save File Object (SAVF, 242KB)
  RPG UDF Example
RPG UDF Code
RPG UDF Description
  External UDTF Example – S/36 Data Access
UDTF Description (159KB)
UDTF With ScratchPad (RPGLE, 11.7KB)
UDTF Without ScratchPad (RPGLE, 12KB)

Trigger Coding Examples

  Before Update Trigger
  After Update Trigger
  After Update Trigger (without null values)
  Trigger with Update

Statistics Manager Examples & Utilities

  CL commands for the Statistics Manager APIs can be found in Document 27792718 of the iSeries Software Knowledge Base
  Procedure for Manual Stats Script Generation

Referential Integrity Coding Examples

  Referential Integrity with RESTRICT Rule
  Application simulation before Referential Integrity

Journal-Related Examples & Tools

  Display Journal Bundle Program Examples
  Utilities & Performance Tools
  Remote Journal API Examples (ILE RPG)
Note: When using the following examples, use qualified names for the CL commands to prevent potential conflicts with CL Commands that IBM or other vendors may provide in the future.
  Adding a Remote Journal
  Add Remote Journal ILE RPG source
  Add Remote Journal CL command source
  Changing a Remote Journal
  Change Remote Journal State ILE RPG source
  Change Remote Journal State CL Command source
  Removing a Remote Journal
  Remove Remote Journal ILE RPG source
  Remove Remote Journal CL command source

ILE & RPG examples for the Remote Journal APIs can also be found in the IBM Redbook “The System Administrator’s Companion to AS/400 Availability and Recovery”, (SG24-2161).


  Please send questions or comments to: rchudb@us.ibm.com.



 
Additonal Resources

DB2 for i manuals

Graphical management tools

Technical information and tips


Plugins
Get Adobe® Reader®