SQL Programming Manual for TAL
Dynamic NonStop SQL Operations
HP NonStop SQL Programming Manual for TAL—527887-001
7-23
Using the Names Buffer
The program can now prompt the user for the input parameter values, set the pointer 
to the first SQLVAR element in the input SQLDA, and read through the SQLVAR array, 
storing each value the user enters into the appropriate position in memory.
Using the Names Buffer
If you specified NAMES INTO in your DESCRIBE INPUT statement, the names buffer 
contains the names of the parameters, which you can use to prompt the user for 
parameter values. If indicator parameters were specified, the names of the indicator 
parameters are also in the names buffer (for more information on this section, see 
Handling Null Values
 on page 7-36).
The data returned to the names buffer is in this form:
len-1 name-1 len-2 name-2 ... len- n name- n
where name-1 represents the first name, name-2 the second, and name-n the last. The 
name length information is a 2-byte integer (SQL data type PIC S9(4) COMP; TAL data 
type INT). All names with a length of an odd number of characters are padded with a 
blank to make the length an even number; when you display the names, you might 
want to check for this blank padding. Expressions appear as a null string with a length 
of 0.
For the program to determine the names in the names buffer, you can write a routine to 
return the VARCHAR structure for a name when given the index of the parameter 
information desired. After the DESCRIBE INPUT statement executes, the information 
for each parameter is in the SQLVAR array; the VAR^PTR field contains the address of 
the length field for each parameter name in the names buffer.
Figure 7-3. Allocating Memory for Values (page 2 of 2)
--Allocate memory for the data value and assign the byte
--address of the newly allocated data buffer to VAR^PTR:
sqlda.sqlvar[i].var^ptr :=
GETPOOL(pool^head, $DBL(mem^reqd));
IF sqlda.sqlvar[i].var^ptr = -1d THEN
-- Display "Getpool memory management error" message
-- and call ABEND
. . .
VST0703.vsd










