SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-15
Running HP COBOL Compilers in the Guardian
Environment
By default, the compiler generates an object file, RUNUNIT, qualified by the default
system, volume, and subvolume names. To name the object file, specify a target file on
the command line. For example, this command generates an object file, MYPROG:
NMCOBOL /IN MYSRC/ MYPROG; SQL
For natively compiled programs, the SQL directive is not accepted in the source code.
You must specify the SQL directive on the compiler command line as the previous
example shows.
The NMCOBOL compiler does not automatically invoke the linker. You must specify
the RUNNABLE directive either in the source code or on the compiler command line
for the NMCOBOL compiler to call the linker to produce an executable object file
(loadfile):
NMCOBOL /IN MYSRC/ MYPROG; SQL; RUNNABLE
If you specify the RUNNABLE directive but not the CALL-SHARED or SHARED
directive, the NMCOBOL compiler automatically links the program by using the
COBOLFE process and the nld utility to produce a non-PIC loadfile.
If you specify the RUNNABLE and CALL-SHARED directives, the NMCOBOL compiler
automatically links the program by using the ld utility to produce a PIC loadfile:
NMCOBOL /IN MYSRC/ MYPROG; SQL; RUNNABLE; CALL-SHARED
If you do not specify the RUNNABLE directive when compiling the source program,
you must invoke the linker directly to link the object files. For more information, see
The nld or ld Utility on page 6-23.
Finally, you must run the SQL compiler to generate SQL object code in the program
file. For more information, see Running the SQL Compiler in the Guardian Environment
on page 6-27.
Note. Embedded SQL/MP programs are disallowed in user libraries, shared run-time libraries
(SRLs), and dynamic-link libraries (DLLs). When compiling embedded SQL/MP programs, do
not use the SHARED directive, which produces a DLL.
Note. Run the linker before SQL compiling the program.