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:
You use directives to control the way the Compiler behaves. Normally, you need only a few directives. Most of the time, you use the default values. Note that setting some directives affects the default setting of other directives. For example, setting one directive might automatically unset another directive, and some directive settings are mutually exclusive.
On multi-CPU machines, you can enable faster, parallel multi-processor compilation of multiple files in native COBOL projects from Window > Preferences > Micro Focus > Builder.
The Compiler records errors with severity levels ranging from information messages to fatal errors which stop the Compiler working.
If the source code to be compiled contains characters beyond the standard 7-bit ASCII character set (for example, accented characters or characters belonging to multi-byte character sets), you must ensure that the locale has been set correctly, to match the source encoding of these characters. On UNIX, this means setting LANG, LC_CTYPE, or LC_ALL appropriately; each of these variables takes precedence over the former.
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.
By default, Eclipse is configured to build projects automatically whenever you save a file or change a file's or the project's properties. You can turn off automatic building from Window > Preferences > General > Workspace and unchecking Build automatically.
If automatic builds are not enabled, 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.
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.
See Command line reference for more information.
Eclipse reports any errors found in your sources in the Problems and in the Console views.
To navigate to the line of code that generates an error, double-click on the error in the Problems view that has a line number.
Alternatively, follow the link for the source file that has the error in the Console view. In most scenarios, if the error occurred in copybook, following the link in the Console view will open the copybook in context of the source file that references it. If the copybook is referenced by a remote standalone source file, however, then it will not be opened in context.
A limit of 10,000 build errors is set for this product. If this number is reached, Eclipse aborts the build to prevent the build from taking up too much memory on the machine. Some of the source files might not compiled. To compile your application, you need to fix the issues that are reported and then rebuild the entire project.