SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-20
Running HP COBOL Compilers in the OSS
Environment
To compile, link, and SQL compile an embedded SQL/MP program, use this
command:
nmcobol -o /usr/mydir/myprog -Wsql="WHENEVERLIST"
-Wsqlcomp="catalog \$vol.subvol" mysrc.cbl
The -Wsql flag tells the NMCOBOL compiler to expect embedded SQL in the
source file and passes optional SQL directive options, such as
WHENEVERLIST, to the NMCOBOL compiler. For natively compiled programs,
the SQL directive is not accepted in the source code but is on the compiler
command line during compilation. For more information, see the SQL Compiler
Directive on page 6-7. The -Wsql flag also invokes the
-Wsqlcomp flag if you do not specify it on the command line.
The -Wsqlcomp flag directs the nmcobol utility to invoke the SQL/MP
compiler (SQLCOMP) after the linking step, passing the specified arguments to
the SQL/MP compiler. In this case, a catalog, $vol.subvol, is passed to the
SQL/MP compiler.
The -o flag directs the nmcobol utility to use the specified path name instead
of default a.out for the executable file produced.
By default, the nmcobol utility automatically invokes the nld utility to link object
files into a non-PIC object file (loadfile). To create a PIC program loadfile, use the
-Wcall_shared flag to invoke the ld utility:
nmcobol -o /usr/mydir/myprog -Wcall_shared -Wsql mysrc.cbl
You can optionally pass arguments to the ld utility using the -Wld or -Wld_obey
flag. For more information, see the ld and rld Reference Manual.
To suppress the invocation of the linker, use the -c or -Wnolink flag on the
nmcobol command line:
In this example, the -c flag directs the nmcobol utility to compile the specified
source file, mysrc.cob, but not to link it or remove the object file, mysrc.o,
that is created in the current directory:
nmcobol -c mysrc.cob
This command invokes the SQL/MP compiler to SQL compile the program file,
myprog, without invoking the linker:
nmcobol -Wnolink -Wsql myprog
To invoke the nld utility to link object files into a non-PIC program file, and then
invoke the SQL/MP compiler to SQL compile the program file, use this command:
nmcobol -o myprog -Wnld="set heap_max 64" -Wsql x.o y.o z.o
Note. Do not use the -Wsql and -s flags in the same invocation of the nmcobol
utility. The -s option strips symbols information from the object file. The SQL compiler
requires the symbols region to be present for SQL compilation to succeed.