Previous Topic Next topic Print topic


Compiling COBOL code

Before you can run a program, you have to compile the source code.

By default, your project is built automatically, every time you save the project. This ensures that whenever a resource changes, an incremental build starts and all resources modified since the last build are rebuilt. You can force a manual build too, by cleaning the project.

You can configure the compilation using the following techniques:

The Compiler records errors with severity levels ranging from information messages to fatal errors which stop the Compiler working.

When you compile, the Compiler can produce executable code directly or object code. Object code is not executable, and has to be linked to the run-time system to create an executable file. If your project is set to build to .int and .gnt, by default the Compiler produces .int code during its syntax checking phase, and then it can produce .gnt code during the generating phase. You can modify this behavior from the project or the file properties.

Compiling from the command line

Using the command line, you can compile and link your program in one step using the cob command.

You can either specify all the information required on the command line, or use the Compiler prompts.

Compiling from the IDE

By default Eclipse builds your project automatically whenever you save a file. If you haven't configured Eclipse to do this, you can build a project at any time by selecting the project in the COBOL Explorer view and clicking Project and then Build Project to build the currently selected project, Build All to build all projects in the current workspace, or Build Working Set to build a subset of the projects in the workspace. To turn off automatic building, select Window > Preferences > General > Workspace and clear the Build automatically check box.

Important: For applications that use a RDBMS, you might need to set some additional directives in your build configuration.
Previous Topic Next topic Print topic