NonStop SQL/MP Reference Manual

Table Of Contents
NonStop SQL/MP Reference Manual142115
O-6
Examples—OPEN
Examples—OPEN
The following program fragment declares and opens a cursor, uses FETCH to
retrieve data, then closes the cursor:
EXEC SQL DECLARE CURSOR1 CURSOR FOR
SELECT COL1, COL2, COL3 FROM =PARTS
WHERE COL1 >= :HOSTVAR1 ORDER BY COL1 BROWSE ACCESS;
EXEC SQL OPEN CURSOR1;
EXEC SQL FETCH CURSOR1 INTO :HOSTVAR1, :HOSTVAR2, :HOSTVAR3;
EXEC SQL CLOSE CURSOR1;
OSS NAMES
OSS names are names used for files that belong to the Open System Services
environment on a Tandem NonStop System, rather than to the Guardian environment.
NonStop SQL/MP databases reside in the Guardian environment of a NonStop System
but you can access NonStop SQL/MP databases with programs from either the Guardian
environment or the OSS environment. NonStop SQL/MP program files from the OSS
environment have OSS names.
OSS names have two forms, pathnames and ZYQ names.
A pathname is a standard form of OSS file name and is described in detail in
documentation for the OSS environment. You use pathnames to identify files (including
SQL program files) within the OSS environment. Each pathname can have up to 1023
characters and a typical pathname might look like this:
/a/b/c/d/myfile
You use a pathname to specify an SQL program in an OSS file when you invoke c89 to
compile an SQL program, but you cannot use a pathname as a parameter on an SQL
statement or in an SQLCI command.
Each pathname is associated with a physical file that can have other pathnames as well
and that also has a special form of Guardian name referred to as a ZYQ name. A ZYQ
name is so-called because the subvolume portion of the name always begins with the
letters ZYQ. The full form of the name is as follows:
$vol.ZYQnnnnn.Ziiiiiii
nnnnn and iiiiiii are alphanumeric strings that identify the file within the file system.
Each ZYQ file is an OSS file that has one or more corresponding pathnames.
Each SQL program in an OSS file has at least one pathname and exactly one ZYQ
name. You use the pathname to identify the file in the OSS environment where you
create, compile, execute, and maintain the program. NonStop SQL/MP uses the ZYQ
name to identify the file in a NonStop SQL/MP catalog.