SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Dynamic SQL Rowsets
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
12-7
Setting the Rowset-Specific Descriptor Fields
set this descriptor field manually, use the sizeof function and make its value equal to
sizeof (individual array element).
Table 12-1 lists minimum values you can use to set the
ROWSET_VAR_LAYOUT_SIZE descriptor field for various data types. Values larger
than those listed do not raise an error provided the individual array element is also
equally large.
Note. The SQL/MX extension TYPE -601 (character varying with length specified in the first
two bytes) is a special case. If rowsets are to be used with this data type, the
ROWSET_VAR_LAYOUT_SIZE field must not include the two bytes used to specify varying
character length. In this case, the ROWSET_VAR_LAYOUT_SIZE field must contain the
length of the data buffer from the end of one two-byte length specification to the start of the
next two-byte length specification, in bytes (that is, step size for the data buffer that contains
the character varying data). Use a struct with two fields to hold the two-byte length
specification in one field and the character data in the second field. If you do not, then the
space allocated for each character value (maximum length of varchar) must be an even
number. If you use structs to hold the length specification and varchar data, the maximum
length of varchar can be either even or odd.
Table 12-1. Minimum Values for ROWSET_VAR_LAYOUT_SIZE Descriptor
Field (page 1 of 2)
SQL Data Type ROWSET_VAR_LAYOUT_SIZE
CHAR[ACTER](l)
PIC[TURE] X(l)
CHAR[ACTER] VARYING (l)
VARCHAR[ACTER] (l)
(l + 1) if CHARSET = ISO88591
(l + 1) * 2 if CHARSET = UCS2, KANJI
OR KSC5601
*
NUMERIC (1 to 4, s) SIGNED
NUMERIC (1 to 4, s) UNSIGNED
2
NUMERIC (5 to 9, s) SIGNED
NUMERIC (5 to 9, s) UNSIGNED
4
NUMERIC (10 to 18, s) SIGNED
NUMERIC (10 to 18, s) UNSIGNED
8
PIC[TURE] [S] 9( l-s)V9( s) COMP Same as NUMERIC
DEC[IMAL] ( l, s) SIGNED l+2 if TYPE_FS=151 (_SQLDT_DES_LSS)
l+1 if TYPE_FS=152 (_SQLDT_DES_LSE)
DEC[IMAL] ( l, s) UNSIGNED l+1
PIC[TURE] [S] 9( l-s)V9( s) Same as DECIMAL UNSIGNED
SMALLINT SIGNED
SMALLINT UNSIGNED
2
*
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.