SQLCODE structure

Description

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

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

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

Mapping server messages to SQLCODE

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

Other server messages may 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 when 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 messages and codes for any of these products.

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.