SQL/MP Programming Manual for COBOL
Dynamic SQL Operations
HP NonStop SQL/MP Programming Manual for COBOL—529758-003
10-24
Prompting the User for Input Values
IND-PTR points to a flag in Working-Storage that indicates whether the parameter 
actually was null. If the parameter or output variable is not null, you use the 
location referenced by VAR-PTR to indicate the value.
If your program processes indicator parameters, IND-PTR points to the indicator 
parameter associated with that input parameter in the names buffer after DESCRIBE 
INPUT executes. This behavior is parallel to that of VAR-PTR after DESCRIBE INPUT 
or DESCRIBE executes. 
You access the IND-PTR in the SQLVAR array in the same way you access VAR-PTR: 
you call SQLADDR to make IND-PTR point to the Working-Storage flag that indicates 
whether the value is null. If you want all your parameters and output parameters to 
handle null values, your program should access IND-PTR every time it accesses 
VAR-PTR.
Figure 10-2 illustrates the structure of the names buffer immediately after DESCRIBE 
INPUT executes when indicator parameters are present for two parameters, where 
len is a 2-byte length, name is a parameter name, ind-len is the length of an 
indicator parameter name, and ind-name is an indicator parameter name.
Like parameter names, indicator variable names are blank padded to even lengths.
Prompting the User for Input Values
If there are input parameters, prompt the user for values before executing the SQL 
statement. Read the name of each parameter and prompt the user for each value in 
this way:
1. Loop through the names buffer and read each value into the data buffer you have 
allocated for the parameter, according to the data type of the value.
2. If the parameter can be null (NULL-INFO is -1) and the value entered was null, set 
the indicator variable at the location in IND-PTR to -1. 
Before prompting for input, use the DATA-TYPE field in the SQLDA structure to 
evaluate input parameter values. Example 10-1 on page 10-25 shows one way to do 
this.
Figure 10-2. Names Buffer Structure
VAR-PTR
of
SQLVAR(1)
IND-PTR of
SQLVAR(1)
VAR-PTR
of
SQLVAR(2)
IND-PTR of
SQLVAR(2)
len1
name1
ind-len-1 ind-name-
1
len2
name2
ind-len-2 ind-name-
2
VST008.vsd










