Field descriptions

The names in the following table are those provided by the SQL INCLUDE statement. For the most part, C (and C++), COBOL, FORTRAN and PL/I use the same names. RPG names are different, because in RPG/400®, they are limited to 6 characters. In ILE RPG, both a long name and the short 6 character name is supported. Note one instance where PL/I names differ from the COBOL names.

Table 88. Names Provided by the SQL INCLUDE Statement
C Name
COBOL Name
PL/I Name
FORTRAN1
Name
ILE RPG Name
RPG/400 Name
Field
Data Type
Field Value
SQLCAID sqlcaid Not used SQLCAID SQLCAID SQLAID CHAR(8) An "eye catcher" for storage dumps, containing 'SQLCA'.
SQLCABC sqlcabc Not used SQLCABC SQLCABC SQLABC INTEGER Contains the length of the SQLCA, 136.
SQLCODE sqlcode SQLCOD SQLCODE SQLCODE SQLCOD INTEGER Contains an SQL return code.
Code
Meaning
0
Successful execution although SQLWARN indicators might have been set.
positive
Successful execution, but with a warning condition.
negative
Error condition.
SQLERRML2 sqlerrml SQLTXL SQLERRML SQLERRML SQLERL SMALLINT Length indicator for SQLERRMC, in the range 0 through 70. 0 means that the value of SQLERRMC is not pertinent.
SQLERRMC2 sqlerrmc SQLTXT SQLERRMC SQLERRMC SQLERM CHAR (70) Contains message replacement text associated with the SQLCODE. For CONNECT and SET CONNECTION, the SQLERRMC field contains information about the connection, see Table 91 for a description of the replacement text.
SQLERRP sqlerrp SQLERP SQLERRP SQLERRP SQLERP CHAR(8) Contains the name of the product and module returning the error or warning. The first three characters identify the product:
  • ARI for DB2 for VM and VSE
  • DSN for DB2 UDB for z/OS
  • QSQ for DB2 UDB for iSeries
  • SQL for all other DB2® products
See CONNECT (Type 1) or CONNECT (Type 2) for additional information.
SQLERRD sqlerrd SQLERR SQLERRD SQLERRD SQLERR3 Array Contains six INTEGER variables that provide diagnostic information, see Table 90 for a description of the diagnostic information.
SQLWARN sqlwarn SQLWRN SQLWARN SQLWARN SQLWRN4 CHAR(11) A set of 11 CHAR(1) warning indicators, each containing blank or 'W' or 'N'.
SQLSTATE sqlstate SQLSTT SQLSTATE SQLSTATE SQLSTT CHAR(5) A return code that indicates the outcome of the most recently executed SQL statement.
Notes:
1
The first name indicates the IBM® SQL SQLCA names for the FORTRAN SQLCA. The second name indicates an alternative name that is available due to the DB2 UDB for iSeries implementation of the SQLCA in FORTRAN.
2
In COBOL, SQLERRM includes SQLERRML and SQLERRMC. In PL/I, the varying-length string SQLERRM is equivalent to SQLERRML prefixed to SQLERRMC.
3
In RPG/400, SQLERR is defined as 24 characters (not an array) that are redefined by the fields SQLER1 through SQLER6. The fields are full-word binary. In ILE RPG, SQLERR is also redefined as an array. The name of the array is SQLERRD.
4
In RPG/400, SQLWRN is defined as 11 characters (not an array) that are redefined by the fields SQLWN0 through SQLWNA. The fields are full-word binary. In ILE RPG, SQLWRN is also redefined as an array. The name of the array is SQLWARN.
Table 89. SQLWARN Diagnostic Information
C Name
COBOL Name
PL/I Name
FORTRAN1
Name
ILE RPG Name
RPG/400 Name
Field Value
SQLWARN0
sqlwarn[0]
SQLWRN(0) SQLWARN(1:1) SQLWARN(1) SQLWN0 Contains 'W' if at least one other indicator contains 'W' or 'N', it is blank if all other indicators are blank.
SQLWARN1
sqlwarn[1]
SQLWRN(1) SQLWARN(2:2) SQLWARN(2) SQLWN1 Contains 'W' if the value of a string column was truncated when assigned to a host variable. Contains 'N' if *NOCNULRQD was specified an the CRTSQLCI or CRTSQLCPPI command (or CNULRQD(*NO) on the SET OPTION statement) and if the value of a string column was assigned to a C NUL-terminated host variable and if the host variable was large enough to contain the result but not large enough to contain the NUL-terminator.
SQLWARN2
sqlwarn[2]
SQLWRN(2) SQLWARN(3:3) SQLWARN(3) SQLWN2 Contains 'W' if the null values were eliminated from the argument of a function; not necessarily set to 'W' for the MIN function because its results are not dependent on the elimination of null values.
SQLWARN3
sqlwarn[3]
SQLWRN(3) SQLWARN(4:4) SQLWARN(4) SQLWN3 Contains 'W' if the number of columns is larger than the number of host variables.
SQLWARN4
sqlwarn[4]
SQLWRN(4) SQLWARN(5:5) SQLWARN(5) SQLWN4 Contains 'W' if a prepared UPDATE or DELETE statement does not include a WHERE clause.
SQLWARN5
sqlwarn[5]
SQLWRN(5) SQLWARN(6:6) SQLWARN(6) SQLWN5 Reserved
SQLWARN6
sqlwarn[6]
SQLWRN(6) SQLWARN(7:7) SQLWARN(7) SQLWN6 Contains 'W' if date arithmetic results in an end-of-month adjustment.
SQLWARN7
sqlwarn[7]
SQLWRN(7) SQLWARN(8:8) SQLWARN(8) (SQLWN7 Reserved
SQLWARN8
sqlwarn[8]
SQLWRX(1) SQLWARN(9:9) SQLWARN(9) SQLWN8 Contains 'W' if the result of a character conversion contains the substitution character.
SQLWARN9
sqlwarn[9]
SQLWRX(2) SQLWARN(10:10) SQLWARN(10) SQLWN9 Reserved
SQLWARNA
sqlwarn[10]
SQLWRX(3) SQLWARN(11:11) SQLWARN(11) SQLWNA Reserved
Table 90. SQLERRD Diagnostic Information
C Name
COBOL Name
PL/I Name
FORTRAN1
Name
ILE RPG Name
RPG/400 Name
Field Value
SQLERRD(1)
sqlerrd[0]
SQLERR(1) SQLERRD(1) SQLER1 Contains the last four characters of the CPF escape message if SQLCODE is less than 0. For example, if the message is CPF5715, X'F5F7F1F5' is placed in SQLERRD(1).1

For a call to a procedure, contains the return status value specified on the RETURN statement. If a return status value is not specified on the RETURN statement,

  • 0 is returned if the CALL statement is successful, or
  • –200 is returned if the CALL statement is not successful.
SQLERRD(2)
sqlerrd[1]
SQLERR(2) SQLERRD(2) SQLER2 Contains the last four characters of a CPD diagnostic message if the SQL code is less than 0.1

For a CALL statement, SQLERRD(2) contains the number of result sets.

For an OPEN statement, if the cursor is insensitive to changes, SQLERRD(2) contains the actual number of rows in the result set. If the cursor is sensitive to changes, SQLERRD(2) contains an estimated number of rows in the result set.

SQLERRD(3)
sqlerrd[2]
SQLERR(3) SQLERRD(3) SQLER3 For a CONNECT for status statement, SQLERRD(3) contains information on the connection status. See CONNECT (Type 2) for more information.

For INSERT, UPDATE, REFRESH, and DELETE, shows the number of rows affected.

For a FETCH statement, SQLERRD(3) contains the number of rows fetched.

For the PREPARE statement, contains the estimated number of rows selected. If the number of rows is greater than 2 147 483 647, then 2 147 483 647 is returned.

SQLERRD(4)
sqlerrd[3]
SQLERR(4) SQLERRD(4) SQLER4 For the PREPARE statement, contains a relative number estimate of the resources required for every execution. This number varies depending on the current availability of indexes, file sizes, CPU model, etc. It is an estimated cost for the access plan chosen by the DB2 UDB for iSeries Query Optimizer.

For a CONNECT and SET CONNECTION statement, SQLERRD(4) contains the type of conversation used and whether or not committable updates can be performed. See CONNECT (Type 2) for more information.

For a CALL statement, SQLERRD(4) contains the message key of the error that caused the procedure to fail. The QMHRTVPM API can be used to return the message description for the message key.

For a trigger error in a DELETE, INSERT or UPDATE statement, SQLERRD(4) contains the message key of the error that was signaled from the trigger program. The QMHRTVPM API can be used to return the message description for the message key.

For a FETCH statement, SQLERRD(4) contains the length of the row retrieved.

SQLERRD(5)
sqlerrd[4]

SQLERR(5) SQLERRD(5) SQLER5 For a CALL statement, SQLERRD(5) contains the number of result sets returned from the procedure.

For a CONNECT or SET CONNECTION statement, SQLERRD(5) contains:

  • -1 if the connection is unconnected
  • 0 if the connection is local
  • 1 if the connection is remote

For a DELETE statement, shows the number of rows affected by referential constraints.

For an EXECUTE IMMEDIATE or PREPARE statement, may contain the position of a syntax error.

For a multiple-row FETCH statement, SQLERRD(5) contains +100 if the last row currently in the table has been fetched.

For a PREPARE statement, SQLERRD(5) contains the number of parameter markers in the prepared statement.

SQLERRD(6)
sqlerrd[5]
SQLERR(6) SQLERRD(6) SQLER6 Contains the SQL completion message identifier when the SQLCODE is 0.

In all other cases, it is undefined.

Note:
1
SQLERRD(1) and SQLERRD(2) are set only if appropriate and only if the current server is DB2 UDB for iSeries.
Table 91. SQLERRMC Replacement Text for CONNECT and SET CONNECTION
Description Data type
Relational Database Name CHAR(18)
Product Identification (same as SQLERRP) CHAR(8)
User ID of the server job CHAR(10)
Connection method (*DUW or *RUW) CHAR(10)
DDM server class name
QAS
DB2 UDB for iSeries
QDB2
DB2 UDB for z/OS
QDB2/6000
DB2 UDB for AIX®
QDB2/HPUX
DB2 UDB for HP-UX**
QDB2/LINUX
DB2 UDB for Linux®
QDB2/NT
DB2 UDB for Windows** NT, 2000, and XP
QDB2/SUN
DB2 UDB for SUN** Solaris**
QSQLDS/VM
DB2 Server for VM
QSQLDS/VSE
DB2 Server for VSE
CHAR(10)
Connection type (same as SQLERRD(4)) SMALLINT


[ Top of Page | Previous Page | Next Page | Contents | Index ]