Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

Compiling

COBOL compilation units can be compiled by using the POSIX command cobol. This command is described in detail in section "Controlling the compiler".

Generating an LLM object file (“.o” file)

For each source file it compiles, the compiler generates an LLM and stores it as a POSIX object file with the default name basename.o.
basename is the name of the source file without its directory components and without the .cob or .cbl extension.

When compiling compilation groups, the compiler generates an LLM for each compilation unit and stores each LLM in a POSIX object file. In this case basename is the associated ID-name for the second to the last compilation unit. Lowercase letters are converted to uppercase if required.
Unless otherwise specified, a linkage run is started once the compilation run is completed.You can use the -c option (see section "General options") to suppress the linking phase.

Generating a compiler listing

You can use the -P option (see section "Option for compiler listing output") to request various compiler listings (source listing, diagnostic listing, cross-reference listing and so forth). The compiler writes the listings you request to a listing file with the default name basename.lst and stores it in the current directory. basename is the name of the source file without the directory components and without the suffix .cob or .cbl. In these cases, the name of the source file can also be specified with the option -k file-name.

To print listing files you can use the POSIX lp command (see the “POSIX Commands” manual [29]).

Example of printing a compiler listing

lp -o control-mode=*physical cobbsp.lst

Output locations and output code

The compiler stores the output files in the current directory, i.e. in the directory from which the compiler run was started.
Character and character string constants in the program (object file) are always stored in EBCDIC.

If you store the POSIX file system on a mounted UNIX file system or edit the POSIX files in ASCII code with UNIX system tools, you must store error files (ERRFIL or piped screen output) outside the POSIX file system in BS2000, since code conversion is available only in limited form for these files.

Using compiler variables under POSIX

When the compiler is called under POSIX in BS2000/OSD the values of the compiler variables can be taken over from environment variables. In this case, there is no need to prefix the “SYSDIR-” name part (see also section "Assignment to compiler variables to control source text manipulation").

In POSIX, environment variables are untyped and their content is interpreted as a string in the program during conditional compilation.