DB2 Server for VSE & VM: Quick Reference


SQLCA and SQLDA


SQL Communication Area (SQLCA)

The SQLCA is a collection of variables that are updated at the end of the execution of every SQL statement.
Note:The field names are those provided by the SQL INCLUDE statement for Assembler, COBOL and PL/I. The names for C and FORTRAN are similar.

Field Name and Data Type Description
SQLCAID CHAR(8) The constant SQLCA.
SQLCABC INTEGER Length of SQLCA. Always 136.
SQLCODE INTEGER
Negative: error condition,
Zero: successful execution,
Positive: warning condition.

SQLERRML SMALLINT Length of SQLERRMC.

SQLERRMC VARCHAR(70)

Zero, one, or more tokens separated by X'FF'.
SQLERRP CHAR(8)
Characters 1 to 3 identify the
product.
All 8 characters identify the
module if the SQLCODE < 0.

SQLERRD(1) INTEGER RDS return code.
SQLERRD(2) INTEGER DBSS return code.
SQLERRD(3) INTEGER Number of rows affected by INSERT, UPDATE or DELETE.
SQLERRD(4) INTEGER Rough estimate of resources.
SQLERRD(5) INTEGER
For DELETE with RI: number of
dependent rows.
For local time exit: function number.

SQLERRD(6) INTEGER Reserved.

SQLWARN array:


SQLWARN0 CHAR(1)


'' if all indicators blank,
'S' if SQLWARN6 = 'S',
'W' otherwise.

SQLWARN1 CHAR(1)
'W' if value truncated when assigned
to the host variable.
'Z' if invalid mixed data value
is truncated.

SQLWARN2 CHAR(1) 'W' if null values eliminated from function result.
SQLWARN3 CHAR(1) 'W' if not enough host variables for column values.
SQLWARN4 CHAR(1) 'W' if WHERE missing from prepared UPDATE or DELETE.
SQLWARN5 CHAR(1) 'W' indicates performance degradation.
SQLWARN6 CHAR(1)
'S' if database manager is in
unusable state due to error.
'W' if database manager was
forced to terminate LUW.

SQLWARN7 CHAR(1)
'W' if adjustment made for last day
of month.
'Z' if loss of digits on decimal
division.

SQLWARN8 CHAR(1)
'W' if statement disqualified for
blocking.
'Z' if substitute character used
on conversion.

SQLWARN9 CHAR(1) 'W' if not enough storage for blocking.
SQLWARNA CHAR(1)
'V' if error in converting SQLCA
at application requester.
'W' if blocking factor could not
be maintained.

SQLSTATE CHAR(5) Standard cross-product return code.


SQL Descriptor Area (SQLDA)

An SQLDA is a collection of variables that is required for execution of the DESCRIBE statement, and can optionally be used by the OPEN, FETCH, EXECUTE, PUT, and Extended PREPARE statements.
Note:The field names in the following table are those provided by the SQL INCLUDE statement for Assembler and PL/I. The names for C are the same except that they are in lower case.


Field Name
Data Type

Use in DESCRIBE Use in Other Statements

SQLDAID
CHAR(8)

The constant SQLDA. Not used.

SQLDABC
INTEGER

Length of SQLDA, equal to SQLN*44+16. Same.

SQLN
SMALLINT

Number of occurences of SQLVAR. Same.

SQLD
SMALLINT

Number of columns being described (times 2 if BOTH specified). Zero for a non-SELECT statement. Number of host variables described by occurrences of SQLVAR.


Field Name
Data Type

Use in DESCRIBE Use in Other Statements
SQLVAR array:

SQLTYPE SMALLINT
384/385 date


388/389 time


392/393 timestamp


448/449 short varchar
452/453 character
456/457 long varchar
460/461


464/465 short vargraphic
468/469 graphic
472/473 long vargraphic
480/481 float
484/485 packed decimal
496/497 large integer
500/501 small integer
504/505


384/385 char containing
date
388/389 char containing
time
392/393 char containing
timestamp
448/449 short varchar
452/453 character
456/457 long varchar
460/461 NUL-terminated
string
464/465 short vargraphic
468/469 graphic
472/473 long vargraphic
480/481 float
484/485 packed decimal
496/497 large integer
500/501 small integer
504/505 DISPLAY SIGN
LEADING
SEPARATE


SQLLEN
SMALLINT

External length of column. External length of host variable.

SQLDATA
CHAR(4)
or pointer


SBCS: X'0000' ccsid,
mixed: X'0000' ccsid,
bit: X'0000FFFF',
graphic: X'0000' ccsid,
otherwise: unused.

Address of host variable.

SQLIND
CHAR(4)
or pointer


1st byte set for
character data:
SBCS: X'01'
MIXED: X'02'
BIT: X'FF',
otherwise: unused.
1

Address of indicator variable, if there is one.

SQLNAME
VARCHAR(30)

Name or label of the column.
SBCS: X'0000' ccsid,
mixed: X'0000' ccsid,
bit: X'0000FFFF',
graphic: X'0000' ccsid,
otherwise: unused.


Footnotes:

1
Not available for the DRDA protocol.


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