It is possible that tokens within statements or commands that are passed to the SQLEXEC, SQLDBS, and SQLDB2 routines could correspond to REXX variables. In this case, the REXX interpreter substitutes the variable's value before calling SQLEXEC, SQLDBS, or SQLDB2.
To avoid this situation, enclose statement strings in quotation marks (' ' or " "). If you do not use quotation marks, any conflicting variable names are resolved by the REXX interpreter, instead of being passed to the SQLEXEC, SQLDBS or SQLDB2 routines.
Compound SQL is not supported in REXX/SQL.
REXX/SQL stored procedures are supported on the OS/2 and Windows 32-bit operating systems, but not on AIX.
Before using any of the DB2 APIs or issuing SQL statements in an application, you must register the SQLDBS, SQLDB2 and SQLEXEC routines. This notifies the REXX interpreter of the REXX/SQL entry points. The method you use for registering varies slightly between the OS/2 and AIX platforms. The following examples show the correct syntax for registering each routine:
Sample registration on OS/2 or Windows
/* ------------ Register SQLDBS with REXX -------------------------*/ If Rxfuncquery('SQLDBS') <> 0 then rcy = Rxfuncadd('SQLDBS','DB2AR','SQLDBS') If rcy \= 0 then do say 'SQLDBS was not successfully added to the REXX environment' signal rxx_exit end /* ------------ Register SQLDB2 with REXX -------------------------*/ If Rxfuncquery('SQLDB2') <> 0 then rcy = Rxfuncadd('SQLDB2','DB2AR','SQLDB2') If rcy \= 0 then do say 'SQLDB2 was not successfully added to the REXX environment' signal rxx_exit end /* ----------------- Register SQLEXEC with REXX --------------------*/ If Rxfuncquery('SQLEXEC') <> 0 then rcy = Rxfuncadd('SQLEXEC','DB2AR','SQLEXEC') If rcy \= 0 then do say 'SQLEXEC was not successfully added to the REXX environment' signal rxx_exit end
Sample registration on AIX
/* ------------ Register SQLDBS, SQLDB2 and SQLEXEC with REXX --------*/ rcy = SysAddFuncPkg("db2rexx") If rcy \= 0 then do say 'db2rexx was not successfully added to the REXX environment' signal rxx_exit end
On OS/2, the RxFuncAdd commands need to be executed only once for all sessions.
On AIX, the SysAddFuncPkg should be executed in every REXX/SQL application.
Details on the RXfuncadd and SysAddFuncPkg APIs are available in the REXX documentation for OS/2 and AIX, respectively.