SQL/MX Programming Manual for C and COBOL (H06.10+, J06.03+)
Introduction
HP NonStop SQL/MX Programming Manual for C and COBOL—544617-003
1-3
Declaring and Using Host Variables
modify the eld options to link the application to a DLL instead of an executable. For
more information, see the DLL Programmer’s Guide for TNS/E Systems.
For efficient management of module files, SQL/MX allows the modules to be
located with the corresponding DLLs.
The module files are managed in the following sequence:
1. When the application is executed, SQL/MX automatically identifies the location of
all the DLLs loaded by the application.
2. SQL/MX searches for module files in the locations in the following order:
a. location of the executable program
b. location of the DLL
c. system global module directory called /usr/tandem/sqlmx/USERMODULES
3. SQL/MX loads the module files from all the DLL locations. While loading the
module files, if SQL/MX finds a module that matches the specified name, it stops
searching the module files.
Declaring and Using Host Variables
Host variables are host language variables declared in a host language program and
used in both host language statements and embedded SQL statements. You use host
variables to provide communication between 3GL and SQL statements—to receive
data from a database or to insert data into a database. A host variable can be any valid
host language variable that has a corresponding SQL data type.
Declaring Host Variables
Declare host variables in a Declare Section in the variable declarations part of your
program. A Declare Section begins with BEGIN DECLARE SECTION and ends with
END DECLARE SECTION.
Example
In this example, hv_this_customer and hv_custname are host variables:
EXEC SQL BEGIN DECLARE SECTION;
unsigned NUMERIC (4) hv_this_customer; /* host variables */
char hv_custname[19];
EXEC SQL END DECLARE SECTION;
Note. When DLLs are loaded from multiple locations, the order of search is not defined.
Note. You must ensure that the module file names are unique across the locations of all
the DLLs.
C










