Application Development Guide

API Syntax for REXX

Use the SQLDBS routine to call DB2 APIs with the following syntax:

   CALL SQLDBS 'command string' 

For information on how the DB2 APIs work, see the complete descriptions in the DB2 API chapter of the Administrative API Reference.

If a DB2 API you want to use cannot be called using the SQLDBS routine (and consequently, not listed in the Administrative API Reference), you may still call the API by calling the DB2 command line processor (CLP) from within the REXX application. However, since the DB2 CLP directs output either to the standard output device or to a specified file, your REXX application cannot directly access the output from the called DB2 API nor can it easily make a determination as to whether the called API is successful or not. The SQLDB2 API provides an interface to the DB2 CLP that provides direct feedback to your REXX application on the success or failure of each called API by setting the compound REXX variable, SQLCA, after each call.

You can use the SQLDB2 routine to call DB2 APIs using the following syntax:

   CALL SQLDB2 'command string'

where 'command string' is a string that can be processed by the command-line processor (CLP). Refer to the Command Reference for the syntax of strings that can be processed by the CLP.

Calling a DB2 API using SQLDB2 is equivalent to calling the CLP directly, except for the following:

Since the only REXX variable that is set after you call SQLDB2 is the SQLCA, you only use this routine to call DB2 APIs that do not return any data other than the SQLCA and that are not currently implemented through the SQLDBS interface. Thus, only the following DB2 APIs are supported by SQLDB2:

Activate Database
Add Node
Bind for DB2 Version 1(1) (2)
Bind for DB2 Version 2 or 5(1)
Create Database at Node
Drop Database at Node
Drop Node Verify
Deactivate Database
Deregister
Load(3)
Load Query
Precompile Program(1)
Rebind Package(1)
Redistribute Nodegroup
Register
Start Database Manager
Stop Database Manager

Notes on DB2 APIs Supported by SQLDB2:

  1. These commands require a CONNECT statement through the SQLDB2 interface. Connections using the SQLDB2 interface are not accessible to the SQLEXEC interface and connections using the SQLEXEC interface are not accessible to the SQLDB2 interface.

  2. Is supported on OS/2 through the SQLDB2 interface.

  3. The optional output parameter, pLoadInfoOut for the Load API is not returned to the application in REXX. Refer to the Administrative API Reference for more information on the Load API and its parameters.
Note:Although the SQLDB2 routine is intended to be used only for the DB2 APIs listed above, it can also be used for other DB2 APIs that are not supported through the SQLDBS routine. Alternatively, the DB2 APIs can be accessed through the CLP from within the REXX application.


[ Top of Page | Previous Page | Next Page ]