SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Static Rowsets
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
7-3
Considerations for Rowset Size
To specify a host variable array as a part of a rowset, use this syntax:
rowset-size
specifies the dimension of the host variable array that is a part of the rowset. The
size immediately follows the ROWSET keyword and must be enclosed in square
brackets [ ]. The size is an unsigned integer.
variable-specification
is the data type and name of a host variable. It can be any valid host language
identifier with a data type that corresponds to an SQL data type. For information on
SQL data types and C host variable data types, see Table 3-4 on page 3-10. For
the COBOL equivalent, see Table 4-2 on page 4-7.
Example
This example uses three arrays of 200 elements, which are used to retrieve at most
200 rows of a table. You can use the fourth array as an indicator array for the salary:
EXEC SQL BEGIN DECLARE SECTION;
char SQLSTATE[6];
ROWSET [200] char hva_first_name[16];
ROWSET [200] char hva_last_name[21];
ROWSET [200] unsigned NUMERIC (8,2) hva_salary;
ROWSET [200] short hva_salary_indicator;
...
EXEC SQL END DECLARE SECTION;
EXEC SQL BEGIN DECLARE SECTION END-EXEC.
01 sqlstate pic x(5).
01 rs.
02 ROWSET[200] hvafirstname pic x(15).
02 ROWSET[200] hvalastname pic x(20).
02 ROWSET[200] hvasalary pic 9(8)v9(2) comp.
02 ROWSET[200] hvasalaryindicator pic s9(4) comp.
...
EXEC SQL END DECLARE SECTION END-EXEC.
Considerations for Rowset Size
•
The total rowset size (that is, the size of the row times the number of rows) should
not produce fragmentation in the network or process communication.
ROWSET [rowset-size] variable-specification
Note. In the examples in this section, note that COBOL references the rowset array as
elements 1 through 5. (C references the array as elements 0 through 4.) However, when
NonStop SQL/MX references the COBOL array as a derived table, those elements are
referenced as rows 0 through 4.
C
COBOL