This chapter describes how to compile COBOL programs using OpenCOBOL.
Compiler Options †
The compiler cobc accepts the options described in this section.
Build Target †
The following options specify the target type produced by the compiler:
- Preprocess only. Compiler directives are executed. Comment lines are removed. COPY statements are expanded. The output goes to the standard-out.
- Translation only. COBOL source files are translated into C files. The output is saved in file *.c.
- Compile only. Translated C files are compiled by cc. The output is saved in file *.s.
- Compile and assemble. This is equivalent to cc -c. The output is saved in file *.o.
- Compile, assemble, and build a dynamic-linking module (i.e., a shared library). The output is saved in file *.so. (Default)
- Compile, assemble, and build an executable.
Without any options above, the compiler tries to build an module.
If you give the -x option with -C, you will see the main function in the generated C file.
Source Format †
OpenCOBOL supports both fixed and free source format.
The default format is the fixed format. This can be explicitly overwritten by one of the following options:
- Free format.
- Fixed format.
Warning Options †
- Enable all warnings
- Warn any text after column 72
- Warn lacks of END-EVALUATE
- Warn lacks of END-IF
- Warn lacks of parentheses around AND within OR
Last-modified: Tue, 15 Jan 2008 05:10:38 GMT (1951d)