SQLCODE structure

Description

A SQLCODE structure can be used in conjunction with CTBDIAG to retrieve Client-Library and server error and informational messages. A SQLCODE structure can be located anywhere and mapped to SQLCA.

A SQLCODE structure is defined as a 4-byte integer.

Client-Library always sets SQLCODE and the SQLCODE field of the SQLCA structure identically (See “SQLCA structure”).

Mapping server messages to SQLCODE

A server message number is mapped to a SQLCODE of 0 if it has a severity of 0.

Other server messages can be mapped to a SQLCODE of 0 as well.

Server message numbers are negated before being placed into SQLCODE. This ensures that SQLCODE is negative if an error occurs.

For a list of server messages returned by gateway products (Mainframe ClientConnect, Open ServerConnect, or OmniSQL Access Module for DB2), see the Mainframe Connect Client Option and Server Option Messages and Codes.

Mapping Client-Library messages to SQLCODE

The Client-Library message “No rows affected” is mapped to a SQLCODE of 100.

Client-Library messages with CS-SV-INFORM severities are mapped to a SQLCODE of 0.

Other Client-Library messages may be mapped to a SQLCODE of 0 as well.

Client-Library message numbers are negated before being placed into SQLCODE. This ensures that SQLCODE is negative when an error occurs.

For a list of Client-Library messages, see the Mainframe Connect Client Option and Server Option Messages and Codes.