SQL/MP Programming Manual for C

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for C429847-008
6-28
Developing a C Program in the OSS Environment
When you issue an OBEY command to run the file shown in the next example, ensure
that the DEFINE mode (DEFMODE) is ON, and the DEFINE class is MAP.
The INFO DEFINE format uses the same format as the INFO DEFINE command. This
example shows an INFO DEFINE format report. In an actual report, each guardian-
name and define-name would be replaced by the actual name.
DEFINE NAME =_DEFAULTS
CLASS DEFAULTS
VOLUME guardian-name
CATALOG guardian-name
DEFINE NAME define-name
CLASS MAP
FILE guardian-name
DEFINE NAME define-name
CLASS MAP
FILE guardian-name
... ...
In the next example, the SQL compiler writes an execution plan and DEFINEs to the
spooler location $s.#explain. The compiler also writes the DEFINEs in OBEY
command file format to the file setdefs for subsequent execution. The catalog name
is not included in the SQLCOMP command because it is stored in the program file. The
NOOBJECT option suppresses the generation of a program file, so the SQL compiler
does not register the program file in a catalog.
SQLCOMP / IN sqlprog,OUT $s.#explain / NOOBJECT
EXPLAIN PLAN DEFINES setdefs, OBEYFORM
For more information about the EXPLAIN utility, including detailed examples, see the
SQL/MP Query Guide.
Developing a C Program in the
OSS Environment
Version 315 (or later) SQL/MP software supports the development of C programs in
the OSS environment. You can code a C program that contains embedded SQL
statements with a text editor such as vi or ed and then use the c89 utility to invoke
the C and SQL compilation tools. (C++ does not support embedded SQL statements.)
TNS/R native C programs require version 2 (or later) SQL/MP software
TNS/E native C programs require version 350 SQL/MP software
You can also develop a C program in the Guardian environment that runs in the OSS
environment by specifying the SYSTYPE OSS pragma when you compile the program.
For more information, see Developing a C Program in the Guardian Environment
on
page 6-5.