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

Dynamic SQL With Descriptor Areas
HP NonStop SQL/MX Programming Manual for C and COBOL523627-004
10-4
Describing Input Parameters
Use the DESCRIBE INPUT statement to set information in the descriptor area about
the input parameters. Alternatively, you can use the SET DESCRIPTOR statement to
set information explicitly in the descriptor area for individual input parameters.
Describing Input Parameters
All values in the item descriptor areas are initially undefined. You can use a
DESCRIBE INPUT statement to set information on the input parameters in the
descriptor area.
Use this general syntax:
For complete syntax, see the DESCRIBE statement in the SQL/MX Reference Manual.
When DESCRIBE INPUT executes, NonStop SQL/MX stores information for each
input parameter of the prepared statement in an item descriptor. Each parameter has a
separate area.
The DESCRIBE INPUT statement sets all fields in the item descriptor for each input
parameter, except for the VARIABLE_POINTER, VARIABLE_DATA,
INDICATOR_POINTER, and INDICATOR_DATA fields. COUNT is set equal to the
number of input parameters. For limitations on using the VARIABLE_POINTER item,
see the VARIABLE POINTER in the SQL/MX Reference Manual.
Setting the Data Values of Input Parameters
After you describe input parameter values for a prepared statement, use the SET
DESCRIPTOR statement to set the value of an input parameter in an item descriptor.
Use this general syntax:
For complete syntax, see the SET DESCRIPTOR statement in the SQL/MX Reference
Manual.
The named descriptor area must be currently allocated. You can assign the input value
to the VARIABLE_DATA or VARIABLE_POINTER field in the SQL descriptor area
allocated earlier and then use SET DESCRIPTOR. For limitations on using the
VARIABLE_POINTER item, see the SET DESCRIPTOR statement in the SQL/MX
Reference Manual.
This example uses a typical context for input parameters in dynamic SQL. Specify the
data type of the input parameter by using the CAST function so that DESCRIBE INPUT
correctly types the parameter.
DESCRIBE INPUT statement-name
USING SQL DESCRIPTOR descriptor-name
SET DESCRIPTOR descriptor-name
{ COUNT = value-specification }
{ VALUE item-number desc-item-name = value-spec,... }