DB2 Version 9.7 for Linux, UNIX, and Windows

Calling DB2 APIs in REXX

Use the SQLDBS routine to call DB2® APIs with the following syntax:
   CALL SQLDBS 'command string' 

If a DB2 API you want to use cannot be called using the SQLDBS routine, you can still call the API by calling the DB2 command line processor (CLP) from within the REXX application. However, because 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.

Note: For information about the supported versions of the REXX programming language, see: "Support for database application development in REXX".

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).

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

Because 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:

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 Windows-based platforms through the SQLDB2 interface.
  3. The optional output parameter, poLoadInfoOut for the Load API is not returned to the application in REXX.
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.