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-16
Set Explicit Input Values
Describing the Input Parameters
Use the DESCRIBE INPUT statement to provide information for each dynamic input
parameter in an item descriptor area, except for the actual VARIABLE_DATA and
INDICATOR_DATA values.
Example
EXEC SQL DESCRIBE INPUT sqlstmt USING SQL DESCRIPTOR 'in_sqlda';
Describing the Output Variables
Use the DESCRIBE OUTPUT statement to provide information for each possible
output variable in an item descriptor area—typically, each column in the table referred
to in a SELECT statement.
Example
EXEC SQL DESCRIBE OUTPUT sqlstmt
USING SQL DESCRIPTOR 'out_sqlda';
If the table referred to consists of six columns, information is provided in six item
descriptor areas. The COUNT for the SQL descriptor area is set to 6.
Set Explicit Input Values
If you have dynamic input parameters in your prepared statement, you must code the
appropriate C statements to prompt the user to input the values and set the values in
the descriptor area. See Setting the Data Values of Input Parameters on page 10-4.
Prompting the User
You first prompt the user for the input values.
Examples
printf("Enter the employee number:");
scanf("%hu",&in_empnum);
DISPLAY "Enter the employee number: ".
ACCEPT IN-EMPNUM.
C
C
C
COBOL