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-5
Dynamic SQL With Argument Lists
Dynamic SQL With Argument Lists
If you use dynamic SQL with argument lists only and not descriptor areas, see the 
discussion Preparing an SQL Statement With Dynamic Rowsets on page 12-2. The 
next subsections apply only to dynamic SQL with descriptor areas. Rowset host 
variables can also be used in the USING and INTO clauses of the EXECUTE 
statement for input and output variables, respectively. In this case, you do not need to 
set any descriptor fields.
Using the SET DESCRIPTOR Statement
Use dynamic SQL rowsets with descriptor areas when you need to use descriptor 
areas, such as when the number of arguments is not known until execution time. 
Follow the procedures described in Section 10, Dynamic SQL With Descriptor Areas. 
In addition, these practices are unique to dynamic SQL rowsets.
•
You must set the appropriate value in the rowset-related descriptor fields, 
ROWSET_SIZE, ROWSET_VAR_LAYOUT_SIZE and 
ROWSET_IND_LAYOUT_SIZE before execution. 
For an input descriptor, use the DESCRIBE statement after PREPARE to set the 
appropriate values set in the input descriptor. 
For an output descriptor, set all three descriptor fields, even if the DESCRIBE 
OUTPUT statement is used. The DESCRIBE statement uses compile-time data to 
populate the descriptor and, when using dynamic rowsets as output, no rowset 
specific information exists in the statement that was prepared (see Preparing an 
SQL Statement With Dynamic Rowsets on page 12-2). Use of dynamic rowsets for 
output is an execution-time decision and cannot be inferred by DESCRIBE.
•
When you use rowset host variables to transfer data to and from a database, 
VARIABLE_DATA and INDICATOR_DATA descriptor item fields must not be used. 
Data can be exchanged between an application and a database only if you use the 
VARIABLE_POINTER and INDICATOR_POINTER descriptor fields. Set the 
VARIABLE_POINTER and INDICATOR_POINTER fields to appropriate values 
before executing the statement.
Setting the Rowset-Specific Descriptor Fields
You set the rowset-related descriptor fields ROWSET_SIZE, 
ROWSET_VAR_LAYOUT_SIZE and ROWSET_IND_LAYOUT_SIZE with the SET 
DESCRIPTOR statement. The syntax is: 
SET DESCRIPTOR descriptor-name set-descriptor-info
descriptor-name is:
 [GLOBAL | LOCAL] value-specification
Note. Dynamic SQL rowsets with descriptor areas are not supported in COBOL.










