SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-5
Preparing for Compilation
To compile a COBOL program that contains embedded SQL statements and directives
for execution on a TNS/R system:
1. Add any required class MAP or class CATALOG DEFINEs.
2. Run the NMCOBOL 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 on the compiler command line.
3. If necessary, use the nld or ld utility to combine the COBOL object file with other
object files.
4. 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, 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.
Preparing for Compilation
Before compiling an embedded SQL/MP program, verify that the source code is ready
for compilation and configure the compilation environment. Follow these guidelines:
Requirements for Compiling a COBOL Program on page 6-6
SQL Compiler Directive on page 6-7
Copying Source Code Into a Compilation Unit on page 6-9
Setting DEFINEs on page 6-9
Using PARAM Commands on page 6-11