Using the SQL communication area in REXX applications

The fields that make up the SQL communication area (SQLCA) are automatically included by the SQL/REXX interface.

An INCLUDE SQLCA statement is not required and is not allowed. The SQLCODE and SQLSTATE fields of the SQLCA contain SQL return codes. These values are set by the database manager after each SQL statement is run. An application can check the SQLCODE or SQLSTATE value to determine whether the last SQL statement was successful.

The SQL/REXX interface uses the SQLCA in a manner consistent with the typical SQL usage. However, the SQL/REXX interface maintains the fields of the SQLCA in separate variables rather than in a contiguous data area. The variables that the SQL/REXX interface maintains for the SQLCA are defined as follows:

SQLCODE
The primary SQL return code.
SQLERRMC
Error and warning message tokens.
SQLERRP
Product code and, if there is an error, the name of the module that returned the error.
SQLERRD.n
Six variables (n is a number between 1 and 6) containing diagnostic information.
SQLWARN.n
Eleven variables (n is a number between 0 and 10) containing warning flags.
SQLSTATE
The alternate SQL return code.