SQL/MP Programming Manual for COBOL
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for COBOL—529758-003
10-11
Defining Storage for Input and Output Parameters
The SQLSA stores information about the statement. (In contrast, the SQLDA stores
information about parameters.)
Defining Storage for Input and Output Parameters
This subsection describes how to allocate storage for parameters. The discussion
starts with a description of the SQLDA structure and associated buffers.
SQLDA Structure, Names Buffer, and Collation Buffer
SQL/MP uses the SQL descriptor area (SQLDA) to return information about input
parameters and output parameters in dynamic SQL statements. The SQLDA also
stores pointers to these optional data buffers:
The names buffer, which stores the names of input parameters or lists the names
of selected columns.
The collation buffer, which receives copies of any collations used by columns in the
query.
You can use the SQLDA data structure in:
A DESCRIBE INPUT statement to return information about input parameters.
A DESCRIBE statement to return information about output columns or copies of
any collations used by the columns
The USING DESCRIPTOR clause of a FETCH statement to retrieve rows from an
SQL table.
The USING DESCRIPTOR clause of an EXECUTE statement to execute a
dynamic SQL statement.
The sizes of the SQLDA and names buffer depend on the number of input parameters
or output parameters referenced in dynamic SQL statements. Your program can have
more than one SQLDA. In some cases, you can reuse the same structure for different
SQL statements.
If there are input parameters in the dynamic SQL statement, you must have an input
SQLDA to describe them. Similarly, if your program handles dynamic SELECT
operations, declare an SQLDA to describe the output results (SELECT columns).
If your application prompts the user for parameter values or displays column names for
output to the user, declare one or more names buffers.
SQLDA Contents
Table 10-2 describes the information stored in the SQLDA structure. Note that the
SQLDA structure contains an SQLVAR record for each input parameter or output
variable.