-c
Purpose
Prevents the completed object from
being sent to the linker. When this option is in effect, the compiler
creates an output object file, file_name.o
.
This option applies only to compiling.
Syntax
Defaults
By default, the compiler invokes the linker to link object files into a final executable file.
Examples
- To compile one file that is called
alpha.cbl
, enter:cob2 -c alpha.cbl
The compiled file is named
alpha.o
. - To compile two files that are called
alpha.cbl
andbeta.cbl
, enter:cob2 -c alpha.cbl beta.cbl
The compiled files are named
alpha.o
andbeta.o
. - To link two files, compile them without the
-c
option. For example, to compile and linkalpha.cbl
andbeta.cbl
and generate gamma, enter:cob2 alpha.cbl beta.cbl -o gamma
This command creates
alpha.o
andbeta.o
, then linksalpha.o
,beta.o
, and the COBOL libraries. If the link step is successful, it produces an executable program named gamma. - To compile
alpha.cbl
with theLIST
andNODATA
options, enter:cob2 -qlist,noadata alpha.cbl