IBM COBOL for Linux application compile and link options

The compile and link options for building COBOL embedded SQL and API applications with the IBM COBOL for Linux on x86 compiler are available in the bldapp build script.

When the bldapp script invokes the COBOL compiler, the EXEC SQL statements in your program have already been translated to COBOL language statements in a prior step. Alternatively, you can use the COBOL compiler's integrated Db2 coprocessor to translate the EXEC SQL statements and perform the compilation at the same time. To use the integrated coprocessor, add the -qsql option to the compile options described below. Compilation and linking can also be performed in a single invocation of the cob2 command by combining the compilation and linking options described below, and omitting the -c option.

Compile options:
cob2
The IBM® COBOL on x86 compiler.
-qpgmname\(mixed\)
Instructs the compiler to permit CALLs to library entry points with mixed-case names.
-I$DB2PATH/include/cobol_a
Specify the location of the Db2® include files. For example: $HOME/sqllib/include/cobol_a.
-c
Perform compile only; no link. Compile and link are separate steps.
Link options:
cob2
Use the compiler as a front end for the linker.
-o $1
Specify the executable program.
$1.o
Specify the program object file.
checkerr.o
Include the utility object file for error-checking.
-L$DB2PATH/$LIB
Specify the location of the Db2 runtime shared libraries. For example: $HOME/sqllib/lib32.
-ldb2
Link with the database manager library.

Refer to your compiler documentation for additional compiler options.