Defining the SQL communications area, SQLSTATE, and SQLCODE in REXX

When DB2® prepares a REXX program that contains SQL statements, DB2 automatically includes an SQLCA in the program.

About this task

The REXX SQLCA differs from the SQLCA for other languages. The REXX SQLCA consists of a set of separate variables, rather than a structure.

Start of changeThe SQLCA has the following forms: End of change

  • A set of simple variables
  • A set of compound variables that begin with the stem SQLCA

Start of changeThe simple variables is the default form of the SQLCA. Using CALL SQLEXEC results in the compound stem variables. Otherwise, the attachment command used determines the form of the SQLCA. If you use the ADDRESS DSNREXX 'CONNECT' ssid syntax to connect to DB2, the SQLCA variables are a set of simple variables. If you use the CALL SQLDBS 'ATTACH TO' syntax to connect to DB2, the SQLCA variables are compound variables that begin with the stem SQLCA.End of change

Switching forms of the SQLCA within an application is not recommended.