11.5.2 Obtaining and using detailed error information

When an error occurs in the distributed server and an SQLCODE shown in Table1113 is set in the distributed client, detailed information can be obtained by issuing the GET DIAGNOSTICS statement. The type of the DBMS of the distributed server can also be determined by displaying as part of the detailed information the contents of the SQLCAIDE area of the SQL Communications Areas.

The GET DIAGNOSTICS statement can obtain the following four types of detailed information:

The GET DIAGNOSTICS statement cannot obtain detailed information on an error that occurs while detailed information is being obtained as a result of execution of the GET DIAGNOSTICS statement.

Table 11-13 shows the statement information items that can be obtained by the GET DIAGNOSTICS statement when an error occurs at the distributed server.

Table 11-13 Statement information items obtained by GET DIAGNOSTICS statement when error occurs at distributed server

Statement information item nameSQL statementContents
NUMBEROther than CALL statement1
CALL statement1 + number of errors in distributed server diagnostic area
MOREOther than CALL statementN
CALL statement
Y
Number of errors at distributed server is greater than number of errors in distributed server diagnostic area
N
Number of errors at distributed server equals number of errors in distributed server diagnostic area

When an error occurs at the distributed server, condition information items can be obtained by the GET DIAGNOSTICS statement by specifying condition number 1. If a CALL statement error occurs at the distributed server, diagnostic information in the distributed server diagnostic information area can be obtained by the GET DIAGNOSTICS statement by specifying condition number 2 or greater.

Table 11-14 shows the condition information items that can be obtained when an error occurs at the distributed server by specifying condition number 1.

Table 11-14 Condition information items obtained by specifying condition number 1 (error at the distributed server)

Condition information item nameInformationContents
RETURNED_SQLCODEAvailableSQLCODE returned by distributed server1
None02
ERROR_POSITIONNone0
ERROR_SQL_NONone0
ERROR_SQLNoneOne blank
ROUTINE_TYPENoneOne blank
ROUTINE_SCHEMANoneOne blank
ROUTINE_NAMENoneOne blank
MESSAGE_TEXTAvailableMessage text returned by distributed server
NoneOne blank
RDNODE_NAMEAvailableRD node name of distributed server
1 Applicable when the SQLCODE of the distributed server is -861.
2 A 0 is set in SQLCODE because no SQLCODE is returned when the SQLCODE of the distributed server is -862.