Editing COBOL text

The COBOL Editor provides functions that increase productivity when you edit a file.

Selecting words and phrases

Use the following tips for editing text in the COBOL Editor:
  • To select a word, double-click it.
  • To select a quoted phrase, double-click immediately after the open quotation mark or immediately before the close quotation mark.
  • To select a phrase in parentheses or brackets, double-click immediately after the open parenthesis or bracket or immediately before the close parenthesis or bracket.

Searching text in file

Use the following methods to search for text in the COBOL Editor:
  • Select and right-click the text in the editor, click Search Text in File from the menu.
  • Invoke the Search Text in File (Ctrl+Alt+F) menu action, and type the text to be searched.
Note: The search text is case sensitive.

You can select the Restrict search to columns checkbox and restrict the search within the specified columns. If not enabled, the search will be restricted within columns 1 and 80 by default. If the checkbox is selected, but no value is specified in the Start column or End column, the search range is not restricted.

You can select the Case sensitive checkbox to indicate the search is case sensitive. This option is unselected by default.

You can also click Advanced File Search to invoke the default File Search dialog. The search results will be displayed in the Search View.

Limitations: The search within a range will return items that start in the range, but will continue passing the end string value due to an Eclipse API limitation.

Tabbing

All Tab key presses are converted into space characters, regardless of the setting that is defined by Insert spaces for tabs on the Text Editor preference page. The number of spaces that are inserted corresponds to the Displayed tab width setting on the Text Editor page. If a file contains a tab character, it is displayed as a single space, regardless of the Displayed tab width setting.

You can define custom tab stops for the COBOL Editor on the Editor preference page. The default tab settings for the COBOL Editor are columns 8, 12, 17 and every 4 characters after column 17.

Hyperlinks

Hyperlink detectors, as defined on the General > Editors > Text Editors > Hyperlinking preference page, display elements as hyperlinks when you hold down the Ctrl key. Hovering the cursor over a field or paragraph name in the COBOL Editor and holding down the Ctrl key turns the text into a hyperlink. Clicking the hyperlink opens the declaration in an editor.

Expanding and collapsing divisions

To collapse a COBOL program division, click Collapse COBOL division. To expand a collapsed division, click Expand COBOL division. You can preview a collapsed division by hovering the cursor over the expand icon.

Opening hover information

Hovering the cursor over a record, paragraph, section, COPY statement, or preprocessor statement causes the COBOL hover information to display the structure over the highlighted element. You can press F2 to display information for the selected structure. The hover information contains real-time syntax warnings if any exist. You can also obtain hover information in an open hover information window for COPY statements.

Hovering the cursor over the hover information, opens a toolbar at the bottom of the hover window. The toolbar provides for navigating the hover information and open the structure for editing. The toolbar also contains Open Declaration and Open Perform Hierarchy buttons. Open Perform Hierarchy is enabled only when the element is a paragraph or section language element. If the record has a warning or error annotation that is associated with it, the annotation text is displayed in the hover information.

Showing range of code structure

If the Show range indicator preference is enabled, when the cursor is place on a line of code, the range of the code structure is indicated by a vertical bar on the left side of the editor. To show only the current range of code in the editor, click Show source of selected element only Show Source of Selected Element Only. The Show range indicator preference is on the General > Editors > Text Editors preference page.

Quick fixes

If the editor tools are enabled, suggested changes are provided to resolve a warning or error annotation in the editor.

Language-sensitive help

To obtain language-sensitive help for a source-code file open in the editor, highlight the element for which you need help, or place the cursor in the element, and press Ctrl+Shift+H. The product information center opens to the help topic for that element.