The EXECSQL WHENEVER statement is not valid for REXX. You must check either the SQLCODE or SQLSTATE value for errors or warnings after each EXECSQL call. Additionally, after an EXECSQL call the REXX RC special variable is set to a return code. Valid return codes are:
For example:
SSID = "DB2T" ADDRESS MVS "SUBCOM DSNREXX" IF RC THEN S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX') ADDRESS DSNREXX "CONNECT" SSID IF RC /= 0 THEN DO SAY "FAILURE TO CONNECT TO DATABASE" EXIT 8 END
If you try to use Micro Focus DSNREXX with any DBMS other than DB2 LUW or SQL Server the return code of -1 is returned (SQL error) after the DSNREXX "CONNECT" statement.