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 COBOL—523627-004
10-2
SQL Descriptor Areas
These statements are described on subsequent pages in this section. For the complete
syntax of each statement, see the SQL/MX Reference Manual.
SQL Descriptor Areas
An SQL descriptor area consists of multiple item descriptor areas, together with a
COUNT of the number of those item descriptor areas. You can use an input descriptor
area to store information on input parameters and an output descriptor area to store
information on output variables in your dynamic SQL statement.
When using SQL descriptor areas, note:
•
To identify an SQL descriptor area, use an SQL identifier.
•
To allocate an SQL descriptor area, use the ALLOCATE DESCRIPTOR statement.
•
To provide the necessary information in the input SQL descriptor area to
applications, use the DESCRIBE INPUT statement to describe the input
parameters of a dynamic SQL statement.
•
After you describe the parameters, use the SET DESCRIPTOR statement to set
the input values for the parameters in the input SQL descriptor area. Alternately,
you can use SET DESCRIPTOR to describe the input parameters explicitly
(without using DESCRIBE INPUT) and set the input values.
•
Output variables typically contain columns returned from a SELECT operation. Use
the DESCRIBE OUTPUT statement to describe information in the output SQL
descriptor area about the output variables.
•
After you describe the output variables, use the GET DESCRIPTOR statement to
retrieve information on them from the output SQL descriptor area.
•
To deallocate an SQL descriptor area, use the DEALLOCATE DESCRIPTOR
statement.
SQL Item Descriptors
NonStop SQL/MX uses an input descriptor area to store information on input
parameters and an output descriptor area to store information on output variables in
dynamic SQL statements. Each descriptor area consists a number of item descriptors.
A sufficient number of item descriptors is required to store information on all the
parameters and variables in your dynamic SQL statement.
To store information on input parameters in the descriptor area, use the DESCRIBE
INPUT statement and the SET DESCRIPTOR statement.
To store information on output variables in the descriptor area, use the DESCRIBE
OUTPUT statement. To retrieve information on output variables from the descriptor
area, use the GET DESCRIPTOR statement.