SQL/MP Programming Manual for COBOL85
Introduction
HP NonStop SQL/MP Programming Manual for COBOL85—429326-004
1-5
Error and Status Reporting
contain embedded SQL statements. You must perform only one extra step for an SQL
program: you compile the embedded SQL statement by using the SQL compiler.
1. Add any required class MAP or class CATALOG DEFINEs (you can use class MAP
DEFINEs to specify SQL objects—tables, views, indexes, and collations—and
class CATALOG DEFINEs to specify SQL catalogs).
2. Run the COBOL85 or NMCOBOL compiler, specifying a source file containing
embedded SQL statements as input. The compilation unit must include the SQL
compiler directive and an SQLCODE variable declaration (either declared explicitly
or implicitly with the INCLUDE SQLCA directive).
3. If necessary, run the Binder program (if you used the COBOL85 compiler) or the
nld program (if you used the native mode compiler) to combine the object file with
other object files.
4. To run the SQL program file on a TNS/R system, run the Accelerator on the
COBOL object file as an optional step.
5. Run the SQL compiler (SQLCOMP) to compile the SQL source statements in the
object file and to validate the output SQL program file for execution.
6. Execute the SQL program file either interactively from TACL or the OSS prompt, or
programmatically by using the COBOL CREATEPROCESS routine.
SQL/MP software supports the development of COBOL 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.
Error and Status Reporting
SQL/MP returns error and status information to a host-language program after the
execution of each embedded SQL statement or directive. 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 executed 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.