Here are some tips and tricks for developing COBOL in the Eclipse IDE.
Automatic building | Project > Build
automatically. With this set, whenever changes to a resource are saved, an incremental build starts, which rebuilds all the resources modified since the last build. |
Background parsing |
Window > Preferences > Micro
Focus COBOL > Editor > General > Background checking. With this set, the COBOL code is checked in the background, as you type it. Any errors are underlined with a red squiggly line. |
Copybook expansion |
You can't expand copybooks inline.
Instead, open a copybook in the editor as a file in its own right. |
Collapse/expand and folding | Click the plus and minus in the code to show and hide sections of the program, such as the File section, Linkage section and so on. You can hover over a collapsed section to show it expanded.
To customize this, see Window > Preferences > Micro Focus COBOL > Editor > Folding. |
Content assist and templates | Press ctrl space to insert a snippet of code for the statement you are typing. This gives an outline of the syntax for you to fill in the blanks. You can add more templates in Window > Preferences > Micro Focus COBOL > Editor > Templates. |
Outline view |
The Outline view shows the structure of the program you are editing and enables you to navigate around it. To go to a Data Division item, a COBOL section or paragraph, just click on it in the Outline view. This view is populated when background checking is on) |
Preferences | Window > Preferences > Micro Focus COBOL > Editor. |
Breakpoint - setting |
Run > Toggle Breakpoint or double-click in the left margin. |
Breakpoints view | Shows the breakpoints marked in the current program. Double-click a breakpoint in this view to go to it in the code. The Breakpoints view is shown by default in the Debug perspective at the top right. You can show it by clicking Window > Show View > Breakpoints. |
Data item values | To display a data item's value, you can hover over it, or alternatively right-click it and click Inspect. See also the Variables view below. |
Debug |
See
To debug a program |
Debug view | This view gives a dynamic view of all the threads. For each thread, this view
shows the call/perform stack, showing where the current statement was called from or performed from, and where previous calls and performs came from. You can move the execution point, by right-clicking a thread and choosing an option from the menu. The Debug view is shown by default in the Debug perspective at the top left. You can show it by clicking Window > Show View > Debug. |
Main program to debug |
Run > Debug . On the
General tab, specify the main program file.
To create a launch configuration |
Preferences | Window > Preferences > Micro Focus COBOL > Debug. Among other things, you can choose to display hexadecimal and byte values of data items. |
Stop debugging |
Run > Terminate. You
can also click the red square at the top. See
To debug a program |
Variables view | Shows the data items in the previous and current statements, together with the data items' values. Changed items are highlit in yellow. The Variables view is shown by default in the Debug perspective at the top right. You can show it by clicking Window > Show View > Variables. |
Add files to a project |
File > Import. See
To import existing files |
Build automatically |
Project > Build
automatically. With this set, whenever a resource changes, an incremental build starts and all resources modified since the last build are rebuilt. |
Build settings and build types |
Project > Properties > Micro
Focus COBOL > Build Configuration. You can create a configuration
to represent each type of build, such as for debugging or for a specific platform. To configure and build a COBOL project |
COBOL settings | Project > Properties > Micro
Focus COBOL > Language settings. Use this to set the dialect, character set and directives for the whole project. You can override these for an individual file by right-clicking the file in the Navigator view and clicking Properties > COBOL Settings. |
Copybook paths |
Project > Properties > Micro
Focus COBOL > Copybook Paths. The setting here takes precedence over the COBCPY environment variable setting. |
Copybooks ignored | A project can contain COBOL files that
don't require compiling, such as copybooks. To specify the files to avoid compiling, right-click the folders or individual files in Navigator and click Build action > Ignore.
|
Dependencies | Dependency information is held for each
project, and by default, it is updated when the project is built. This can slow
down the build. To speed up the build, you can update the dependency
information manually before building the project. To do this, right-click the
project or file and click Update All Dependencies or Update Dependencies. |
Run-time Environment Settings |
Project > Properties > Micro
Focus COBOL > Run-time Environment Configuration. See
To configure and run an application
|
Stop a build in progress | Click the red square, Terminate in the Progress view. To turn on this view, click Window > Show View > Other > General > Progress. |