Previous Topic Next topic Print topic


The COBOL Editor

To work with an editor, right-click the file you want to edit in the COBOL Explorer or Project Explorer view and select Open With.

In addition to a standard text editor, the IDE offers a COBOL editor that contains a number of features for efficient COBOL editing. The COBOL editor provides the following features:

Block selection

Allows you to select specific blocks of text from your code. The selection mode is toggled using the button from the toolbar or shortcut key Alt+Shift+A.

COBOL Copy view

COBOL Copy view allows inline expansion of copybooks so you are able to see your code and copybooks in a single view. While some of the features available in the COBOL editor, including finding references and locating definitions, are available in COBOL Copy view, it is a read-only source viewer and you cannot use it to edit code. You also use the debugging facilities from this view.

You can open COBOL Copy view when working in the COBOL Editor view by pressing F4. Pressing F4 again switches you back to the COBOL Editor. You can open COBOL Copy view when editing either a program or a copybook; if you open it when editing a copybook, it shows the content of the copybook inside the program you have chosen to be its default context. You choose this context by right-clicking the copybook in COBOL Explorer and selecting Open In Context.

Code templates

Provides you a snippet of code for the statement you are typing. Press Ctrl+Space to see content assist proposals that include the available code templates. Select and insert a code snippet and it gives you an outline of the syntax for you to fill in the blanks. You can add more templates from the IDE preferences - Window > Preferences > Micro Focus > COBOL > Editor > Templates.

Content Assist

Content assist provides writing assistance that enables you to write syntactically correct code quickly. Content assists provides proposal lists that include procedural and managed COBOL keywords and data items as well as Java types. You can configure the preferences for content assist in COBOL from Window > Preferences > Micro Focus > COBOL > Editor > Content Assist.

For full description about how content assist works, see Editing Assistance in the COBOL Editor.

Copybook Dependency view

Use the Copybook Dependency view to show where in the source file's structure the COPY statements appear, and which copybooks they reference.

Click a copybook reference in the Copybook Dependency view to locate the associated COPY statement at the appropriate line in the source code.

Editing single files

This only applies to native COBOL. The recommended way to work with Visual COBOL is to include all source files in a project because this enables full support for the IDE editing, compiling and debugging features. There is limited support in the IDE for single files, such that are not part of a project.

To open a file in the IDE without a project file, use File > Open File.

Edit the file in the usual way. Note, however, that background syntax checking is not available so no errors are reported as you type. You need to recompile in order for the IDE to check your code and report any issues.

When starting the IDE from the command line, also set the COBCPY environment variable to point to the folders where the IDE should search for copybooks.

To specify the locations of any copybooks used in the single file when the copybooks are not in the same location, set the COPYPATH Compiler directive in the IDE on the Single File Compile page in Window > Preferences > Micro Focus > COBOL as COPYPATH(<location1>;<location2>;...). You then need to recompile the file.

Check Known Errors and Restrictions for information about the level of support for single files.

Folding

Hides or shows 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. You can configure your folding preferences from Window > Preferences > Micro Focus > COBOL > Editor > Folding.

Go To Definition

You can use this feature in both native and JVM COBOL projects to find where an item is defined. Right-click an item and click Go To Definition. Alternatively, press F3. The cursor moves to the line of code where the item is defined. The item is also highlighted in the Outline view. You can find the definition for fields, events, types, methods and properties.

You can also navigate to an item that has been declared in Java from a JVM COBOL source. This applies to fields, types and methods.

Mark occurrences

Marks the occurrences of the selected element (data item or section) in the current file. You can switch this feature on/off when a COBOL Editor/Copy view is opened by pressing Alt+Shift+O.

Open Type

Brings up the Open Type dialog to open a type in the editor. The Open Type selection dialog shows all types existing in the workspace. It's accessible from Navigate > Open Type, or by pressing Ctrl+Shift+T.

Enter a type name, or prefix, or the first characters of the type you want to select. It is displayed in the list. When you select it and double click it you see it displayed in the COBOL editor.

Open Type in Hierarchy

Brings up the Open Type dialog to open a type in the editor and the Type Hierarchy view. The Open Type selection dialog shows all types that exist in the workspace. It's accessible from Navigate > Open Type in Hierarchy or by pressing Ctrl+Shift+H. This option lets you see where a selected type stands in the type hierarchy.

Outline view

Shows the structure of the program you are editing. This is useful for navigating large programs, for example by clicking on a Data Division item, a COBOL section or a paragraph to go to it in the code. You can also right-click an item and choose from a range of relevant options.

The Outline view shows only items from the current editor - if the program is opened in the COBOL editor only items from the current program are visible and not from its copybooks. If the program is opened in the Copy view all items are visible in the editor (the Copy view is a read-only editor) and in the outline.

Program Outline view

Similar to Outline view. When you click a data item declaration in the Program Outline view and this opens the relevant copybook and goes to the relevant line. The Program Outline view always shows the whole program structure, including the elements that are in other files.

Quick Outline view

Similar to Outline view. To start it press Ctrl+O or select Navigate > Quick Outline for an in-place outline of the current source file. When you type while Quick Outline view is displayed you filter the list of displayed elements for easier navigation. Pressing Ctrl+O while Quick Outline view is active displays the same information as in Program Outline.

Read-Only background colorization

When you open a file in read-only mode (in the editor or if you open the COBOL Copy View), the background is colored in light yellow to remind you that you cannot use it for editing files.

Light yellow is the default color but you can change it according your personal preference. To do so, open Window > Preferences > Micro Focus > COBOL > Editor, select a background color from the palette in the Read-Only mode section of the page. Click Apply and then OK.

References

You can use this feature in both native and JVM COBOL projects to find references to an item.

In a native COBOL project, place the cursor on the item, right-click, and select References. Alternatively, press Ctrl+Shift+G. The Search tab displays all the references found in the search. You can explore the results returned, double-clicking on the item moves the cursor to that position in the relevant file.

In a JVM COBOL project you can also specify the scope of the search. Place the cursor on the item being referenced, right-click, and select References. Choose the scope of the search; Workspace, Project or Hierarchy. The Search tab displays all the references found in the scope of the search, with default grouping by package.
Note: The Hierarchy relates to the type or class.
Previous Topic Next topic Print topic