SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)

Dynamic SQL Rowsets
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
12-8
Setting the Rowset-Specific Descriptor Fields
For input descriptors, use DESCRIBE to set the value of this field to the value indicated
in Table 12-1. For DECIMAL and PICTURE 9 DISPLAY data types, the value provided
by DESCRIBE for this field is one less than the value in Table 12-1. The first byte to
store the sign is not accounted for by DESCRIBE because DESCRIBE expects
DECIMAL data to be provided in Leading Sign Embedded (LSE, with TYPE_FS = 152)
format. If the Leading Sign Separate (LSS, with TYPE_FS = 151) format is used for
input, one must be added to the value of ROWSET_VAR_LAYOUT_SIZE provided by
DESCRIBE. Set this field manually for output descriptors.
If the value specified for this descriptor item field does not follow the rules described
here, an execution-time error might be raised for data type mismatch. Memory access
violations might occur if the value for this descriptor field does not follow the rules
described here.
ROWSET_IND_LAYOUT_SIZE
The ROWSET_IND_LAYOUT_SIZE is an item field in a descriptor that specifies the
size of an individual array element in a rowset host variable used as an INDICATOR. A
value 0 (zero) in this field denotes that the indicator host variable is not of rowset type
and is a scalar type. For indicator host variables, ROWSET_IND_LAYOUT_SIZE
denotes the length in bytes for the exact numeric data type used.
For input descriptors, use DESCRIBE to set the value of this field to be equal to two.
DESCRIBE assumes that indicator data provided is of type signed short. If another
type such as signed long is used, you must manually set the value of this descriptor
field. For output descriptors, you also must set this field manually.
INT[EGER] SIGNED
INT[EGER] UNSIGNED
4
LARGEINT 8
FLOAT (1 to 22 bits)
REAL
4
FLOAT (23 to 54 bits)
DOUBLE PRECISION
8
DATE 11
TIME, TIMESTAMP l+1
**
INTERVAL l+1
***
Table 12-1. Minimum Values for ROWSET_VAR_LAYOUT_SIZE Descriptor
Field (page 2 of 2)
SQL Data Type ROWSET_VAR_LAYOUT_SIZE
*
All character format data is assumed to be null terminated. If character format data, such as CHAR, VARCHAR,
DECIMAL, DATE, TIME, TIMESTAMP, or INTERVAL is not null terminated, subtract the null terminator bytes from this
table. For double-byte character sets, multiply the length of the string (in characters) by 2 to get the length in bytes.
**
See on page 3-24 for the appropriate value of l for TIME/TIMESTAMP precision.
***
See INTERVAL Representation on page 3-26 for guidance in computing l. The sign byte is included in l, and the
extra byte (+1) is for the null terminator.