Searching for occurrences of code elements

The search for occurrences action in the editor locates related language elements. You can select an element in the code and other instances are displayed in the Search view and highlighted in the editor. The results from a search occurrence action also contain occurrences present in copy members, include members, and identified preprocessor statements.

About this task

The scope of elements that can be located by using the search for occurrences is different for COBOL and PL/I programs as shown in the following table.
Table 1. Supported program elements
COBOL PL/I
  • Procedural Statement Conditions
  • Procedural End phrases
  • User-defined words
  • IF Statement
  • WHEN statements
  • OTHERWISE statements
  • Matching END statements
  • Variables and labels

In the Search view, read instances and write instances are highlighted differently. Instances that are reads are highlighted in gray and write instances are highlighted in gold.

The mark occurrence and search occurrence actions are similar in that both provide a method to locate related language elements. But they have several differences:
  • Results of a search occurrences operation are included in the Search view along with being highlighted in the editor. The results of a mark occurrence action are included in the editor only.
  • The results of a search occurrences operation include occurrences in copy members, include members, and identified preprocessor statements. These occurrences are not provided in the mark occurrence results.
  • The mark occurrence action is limited to elements selected on the Mark Occurrences preference.

Procedure

  1. In the file, highlight the code element for which you want to locate other occurrences and right-click.
  2. Click Occurrences in Compilation Unit. The Search view displays the found occurrences in the file. Instances of the elements are highlighted as follows:
    • Write instances are highlighted in orange.
    • Read instances are highlighted in gray.
  3. To locate the occurrence in the file, double-click in the code element Search view.

Feedback