Checking the execution of SQL statements by using SQLIMSCODE and SQLIMSSTATE

Whenever an SQL statement executes, the SQLIMSCODE and SQLIMSSTATE fields of the SQLIMSCA receive a return code. The SQLIMSERRMT field of the SQLIMSCA will contain message text that describes the error.

SQLIMSCODE:
IMS returns the following codes in SQLIMSCODE:
  • If SQLIMSCODE = 0, execution was successful.
  • If SQLIMSCODE > 0, execution was successful with a warning.
  • If SQLIMSCODE < 0, execution was not successful.

SQLIMSCODE 100 indicates that no data was found.

SQLIMSSTATE: SQLIMSSTATE enables an application program to check for errors in the same way for different IBM® database management systems.