SQL/MP Programming Manual for COBOL

Explicit Program Compilation
HP NonStop SQL/MP Programming Manual for COBOL529758-003
6-18
Running HP COBOL Compilers in the OSS
Environment
To compile, bind, and SQL compile an embedded SQL/MP program, use this type
of command:
cobol -o /usr/mydir/myprog -L /nonnative/usr/lib
-Wcobol="SQL" -Wsql="catalog \$vol.subvol" mysrc.cbl
The -Wcobol flag directs the cobol utility to pass a string of compiler
directives to the COBOL85 compiler. In this case, the SQL directive tells the
COBOL85 compiler to expect embedded SQL in the source file. The SQL
directive is required either in the source code or on the compiler command line.
For more information, see the SQL Compiler Directive on page 6-7.
The -Wsql flag directs the cobol utility to invoke the SQL/MP compiler
(SQLCOMP), 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 cobol utility to use the specified path name instead of
default a.out for the executable file produced.
The -L flag specifies the /nonnative/usr/lib directory, which contains
libc.a and other .a files that Binder requires to function properly.
To accelerate an object file for TNS/R systems, after compiling and binding and
before SQL compiling the program file, use this type of command:
cobol -o /usr/mydir/myprog -L /nonnative/usr/lib
-Waxcel="StmtDebug" -Wsql mysrc.cob
The -Waxcel flag directs the cobol utility to invoke the Accelerator, passing the
specified arguments to the Accelerator. For more information, see the Accelerator
Manual.
By default, the cobol utility automatically invokes the BINSERV process of the
Binder to bind object files into an executable object file. To suppress the invocation
of the Binder, use the -c or -Wnobind flag on the cobol command line:
In this example, the -c flag directs the cobol utility to compile the specified
source file, mysrc.cob, but not to bind it or remove the object file, mysrc.o,
that is created in the current directory:
cobol -c mysrc.cob
This command invokes the SQL/MP compiler to SQL compile the program file,
myprog, without invoking the Binder:
cobol -Wnobind -Wsql myprog
Note. Do not use the -Wsql and -s flags in the same invocation of the cobol 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.