SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-3
TNS Mode Compilation
To compile a COBOL program that contains embedded SQL statements and directives
for execution on a TNS (or TNS/R) system:
1. Add any required class MAP or class CATALOG DEFINEs.
2. Run the COBOL85 compiler and specify a source file as input.
Your compilation unit must include an SQLCODE variable declaration (either
declared explicitly or implicitly with the INCLUDE SQLCA directive). You must
specify the SQL compiler directive in the compilation unit or on the compiler
command line.
3. If necessary, use the Binder program to combine the COBOL object file with other
object files.
4. Optionally, run the Accelerator on the COBOL object file to optimize it for a TNS/R
system.
5. Run the SQL compiler (SQLCOMP) to compile the SQL source statements in the
COBOL object file and to produce a valid SQL program file for execution.
The SQL program file that is produced can be executed in either the OSS or Guardian
operating environment, depending on how you compile the program:
In the Guardian environment, execute the SQL program file, either interactively by
using the TACL RUN (or RUND) command or programmatically by using the
COBOL CREATEPROCESS or CLU_PROCESS_CREATE_ routine.
In the OSS environment of a TNS/R system, add the directory of the SQL program
file to your search path by using the export command and then execute the SQL
program file by entering its name at the OSS prompt.
For more information, see Section 7, Program Execution.