SQL Programming Manual for TAL

Dynamic NonStop SQL Operations
HP NonStop SQL Programming Manual for TAL527887-001
7-28
Allocating and Filling in Output Variables
The sequence just described displays names and values repetitively. For example:
You can also display the column names as headings (similar to SQLCI) by executing
the following loop. Assume that the value in sqlsa.PREPARE.OUTPUT^NUM was
saved in variable OUTNUM. Loop OUTNUM times:
1. Get the length of the column name.
2. Advance to the name.
3. Display the name with some blank space.
4. Advance to the next length field.
If you use this second method, you will need to execute a second loop to interpret and
display the values, including enough blank space for each value to fall under its column
heading.
You can use data type literals (listed and described under Allocating Memory for the
Values. on page 7-20) to decide how to display output column values.
Figure 7-5
shows sample code for displaying the current row output by a SELECT
statement.
EMPNUM
EMPNAME
2000
JANE ROBERTS
EMPNUM
EMPNAME
1566
CATHERINE WILLIAMS
EMPNUM
EMPNAME
1890
RICHARD SMITH