Pathmaker Programming Guide

Generating NonStop SQL Statements
Creating Services and Servers
067868 Tandem Computers Incorporated 4–67
Direction is ascending. If Start Position is Current or Next, the first row accessed is
identified by the values in the host variables, if such a row exists. If the row does not
exist within the Position Mode subset, the row with the next higher access path
columns (for ascending) or next lower access path columns (for descending) is fetched.
Your service code should initialize the host variables before you perform the
SQL-CURSOR-OPEN paragraph as follows:
If you specified on the Operations Attributes screen “Start Position” equal to First
and the “Position Mode” equal to Exact or Approximate, initialize the access path
columns of the host variable.
If you specified on the Operations Attributes screen “Start Position” equal to First
and the “Position Mode” equal to Table, you do not need to initialize the access
path columns of the host variable.
If you specified on the Operations Attributes screen “Start Position” equal to
“Current” or “Next, ” initialize the access path columns of the host variable with
values from the previously accessed row.
Operating on One Row
After a successful SQL-CURSOR-OPEN, do the first perform of the SQL-CURSOR-
FETCH paragraph. A successful SQL-CURSOR-FETCH results in all columns of one
row being available in the host variables.
If you specified on the Operations Attributes screen “For Modification” equal to Y, the
SQL-CURSOR-UPDATE or SQL-CURSOR-DELETE paragraph can be performed to
update or delete the most recently fetched row. Before performing the
SQL-CURSOR-UPDATE paragraph, the host variables should be initialized with the
new column values; however, the access path columns cannot be updated.
Continue processing by performing the SQL-CURSOR-FETCH paragraph as many
times as you require.
Closing the Cursor
When no more rows are to be FETCHed, perform the SQL-CURSOR-CLOSE
paragraph. Failure to do this results in an error condition the next time the SQL-
CURSOR-OPEN paragraph is performed.