-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

Read syntax diagramSkip visual syntax diagram -c

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 and beta.cbl, enter:
    
    cob2 -c alpha.cbl beta.cbl
    

    The compiled files are named alpha.o and beta.o.

  • To link two files, compile them without the -c option. For example, to compile and link alpha.cbl and beta.cbl and generate gamma, enter:
    
    cob2 alpha.cbl beta.cbl -o gamma
    

    This command creates alpha.o and beta.o, then links alpha.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 the LIST and NODATA options, enter:
    
    cob2 -qlist,noadata alpha.cbl