Introduction
HP NonStop SQL/MP Programming Manual for C—429847-008
1-5
Compiling and Executing a Host-Language Program
Compiling and Executing a Host-Language Program
The steps to compile and run a C program that contains embedded SQL statements
are similar to the steps you follow for a C program that does not contain embedded
SQL statements. You must perform only one extra step for a host-language program:
compiling the embedded SQL statements using the SQL compiler.
1. Compile the C source file (or files) that contain the embedded SQL statements
using the C compiler. The C compiler generates an object file that contains
C object code and SQL source statements.
2. If necessary, use the Binder program in the TNS environment or the native link
editor utility (
nld
) in the TNS/R environment to combine multiple object files into
one executable object file.
3. If you compiled the program in the TNS environment but plan to run it in the TNS/R
environment, consider running the Accelerator for the C object file as an optional
step to optimize the object code.
4. Run the SQL compiler (SQLCOMP) to compile the SQL source statements in the
C object file and to validate the output SQL program file for execution.
5. Run the SQL program file from a terminal using the TACL RUN (or RUND)
command or from a process using a system procedure such as NEWPROCESS or
PROCESS_CREATE_.
Version 315 (or later) SQL/MP software supports the development of C programs
containing embedded SQL statements in both the Guardian and OSS environments.
For more information, see
Section 6, Explicit Program Compilation
and
Section 7,
Program Execution
.
Processing Errors, Warnings, and Status Information
NonStop SQL/MP returns error and status information to a host-language program
after the execution of each embedded SQL statement or directive. NonStop SQL/MP
returns an SQL error or warning number to the SQLCODE variable and more extensive
information to these SQL data structures:
SQL communications area (SQLCA)––run-time information, including errors and
warnings, generated by the most recently run SQL statement
SQL statistics area (SQLSA)––statistics and performance information after the
execution of DML statements and some dynamic SQL statements
SQL descriptor area (SQLDA)––information about input parameters and output
variables in dynamic SQL statements
For more information about the SQLCA and SQLSA structures, see
Section 9, Error
and Status Reporting
. For information about the SQLDA structure, see
Section 10,
Dynamic SQL Operations
.
Summary of Contents for NonStop SQL/MP
Page 4: ......
Page 14: ...Contents HP NonStop SQL MP Programming Manual for C 429847 008 x ...
Page 60: ...Host Variables HP NonStop SQL MP Programming Manual for C 429847 008 2 26 VARCHAR Data Type ...
Page 294: ...SQL MP Sample Database HP NonStop SQL MP Programming Manual for C 429847 008 A 6 ...