SQL/MP Programming Manual for COBOL

Introduction
HP NonStop SQL/MP Programming Manual for COBOL529758-003
1-5
Error and Status Reporting
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
Use class MAP DEFINEs to specify SQL objects—tables, views, indexes, and
collations—and class CATALOG DEFINEs to specify SQL catalogs).
2. Run an HP COBOL compiler (COBOL85 or the NMCOBOL compiler), specifying a
source file containing embedded SQL statements as input.
3. If necessary, run the Binder program (if you used the COBOL85 compiler), the nld
or ld utility (if you used the native mode NMCOBOL compiler) to combine the
COBOL object file with other object files.
4. Optionally, run the Accelerator on the COBOL object file to optimize it for execution
on a TNS/R system.
5. Run the SQL compiler (SQLCOMP) to compile the SQL source statements in the
COBOL 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.