A SQLCA structure can be used in conjunction with CTBDIAG to retrieve Client-Library and server error and informational messages.
01 SQLCA-MSG. 05 SQLCAID PIC X(8). 05 SQLCABC PIC S9(9) COMP VALUE +0. 05 SQLCODE PIC S9(9) COMP VALUE +0. 05 SQLERRM. 49 SQLERRML PIC S9(9) COMP VALUE +0. 49 SQLERRMC PIC X(256). 05 SQLERRP PIC X(8). 05 SQLERRD OCCURS 6 TIMES PIC S9(9). 05 SQLWARN. 10 SQLWARN0 PIC X(1). 10 SQLWARN1 PIC X(1). 10 SQLWARN2 PIC X(1). 10 SQLWARN3 PIC X(1). 10 SQLWARN4 PIC X(1). 10 SQLWARN5 PIC X(1). 10 SQLWARN6 PIC X(1). 10 SQLWARN7 PIC X(1). 05 SQLEXT PIC X(8).
SQLCAID is “SQLCA” (This value is automatically provided).
SQLCABC is ignored.
SQLCODE is the server or Client-Library message number. For information on how Client-Library maps message numbers to SQLCODE, see “SQLCODE structure”. For a list of gateway messages, see the Messages and Codes for Open ServerConnect and Open ClientConnect shipped with this product.
SQLERRML is the length of the actual message text (not the length of the text placed in SQLERRMC).
SQLERRMC is the null-terminated text of the message. If the message is too long for the array, Client-Library truncates it before appending the null terminator.
SQLERRP is the first eight characters of the stored procedure, if any, being executed at the time of the error.
SQLERRD is the number of rows successfully inserted, updated, or deleted before the error occurred.
SQLEXT is ignored.
SQLWARN is an array of warnings:
If SQLWARN0 is blank, all other SQLWARN variables are blank. If SQLWARN0 is not blank, at least one other SQLWARN variable is set to W.
If SQLWARN1 is W, Client-Library truncated at least one column’s value when storing it into a mainframe variable.
If SQLWARN2 is W, at least one null value was eliminated from the argument set of a function.
If SQLWARN3 is W, the number of mainframe variables specified in the into clause of a select statement is not equal to the number of result columns.
If SQLWARN4 is W, a dynamic SQL update or delete statement did not include a where clause.
If SQLWARN5 is W, a server conversion or truncation error occurred.
Copyright © 2005. Sybase Inc. All rights reserved. |
![]() |