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-2
Embedding SQL Statements
SQLMP ALIAS statement within your application to create the needed mappings from
logical to physical names:
CREATE SQLMP ALIAS catalog.schema.name
[\node.]$volume.subvol.filename
When this statement is executed, a mapping is inserted as a row in the MPALIAS
table. Examples of the CREATE SQLMP ALIAS statement appear in the SQL/MX
Reference Manual.
Embedding SQL Statements
To code a 3GL application program to access data in an SQL/MX or in an SQL/MP
database, use embedded SQL statements to receive data from or to insert data into a
database. Use embedded SQL declarations to declare host language variables that
these SQL statements use.
Your embedded SQL host program might look something like this:
EXEC SQL embedded SQL declarations ...
...
host language statement
...
EXEC SQL embedded SQL statement ...
...
In C/C++ and COBOL programs, the keywords EXEC SQL begin an embedded SQL
declaration or statement.
In a C/C++ program, the semicolon (;) ends a declaration or statement. In a COBOL
program, the keywords END-EXEC end a declaration or statement.
You can embed static or dynamic SQL statements in a host language source file. You
code a static SQL statement as an actual SQL statement and run the SQL/MX
compiler to explicitly compile the statement before you run the program. For a dynamic
SQL statement, you code a placeholder variable for the statement and then construct,
compile, and execute the SQL statement at run time.
For a list of SQL statements you can embed in a program, see Section 2, Embedded
SQL Statements.
Embedding SQL Statements in DLL
SQL/MX allows you to embed SQL statements in DLLs to build modular and
manageable products. SQL statements can be embedded in both Guardian and OSS
DLLs.
To build DLLs with embedded SQL statements, follow the compilation steps specified
in 15, C/C++ Program Compilation and 16, COBOL Program Compilation, and then
Note. NonStop SQL/MX does not support mixing embedded SQL calls to SQL/MX and
SQL/MP from the same application process.










