Using Construct Lists to Narrow a Code Search

Once you have generated a construct list in Code Search, you can use the list itself as a condition of a search. That is, you can use the search results to refine a subsequent search.

Suppose you have performed a Code Search for duplicate paragraphs in COBOL programs, storing the results in a list called Matched Paragraphs in the General folder. The next step might be to search for all PERFORM statements that reference the duplicate paragraphs. The example below shows how you might use a Code Search list of duplicate paragraphs as a condition of the search.

  1. Select a list, then click the Down Arrow Button button next to the Search Button button on the tool bar. In the drop-down, choose the type of object you want to execute the search against. The Search window opens.
  2. Select a folder for the new criterion in the General tab, then click the New Criterion Button button on the tool bar. The New Criterion dialog opens. Enter Perform Duplicates in the text field and click OK. Interactive Analysis creates the Perform Duplicates criterion in the selected folder.
  3. Click the here link in the righthand pane of the Search window. The Select Construct Types window opens.
  4. Select Perform in the list of constructs in the lefthand pane, then click OK. Interactive Analysis adds the condition construct to the filter definition in the righthand pane of the Search window:
    Find All Perform
  5. Click the All link. The Condition window opens. Choose:
    • Relationship in the Applies to drop-down.
    • Called Paragraph in the Relationship Type list box.
  6. Click OK. Interactive Analysis adds the relationship to the filter definition in the righthand pane of the Search window:
    Find Perform
    which has related any Paragraph (as Called Paragraph)
  7. Click the any link. The Condition window opens. Choose:
    • List in the Applies to drop-down.
    • General.Matched Paragraphs in the Name drop-down.
    You can filter out list constructs by selecting Does not belong to the list in the Condition window.
  8. Click OK. Interactive Analysis adds the list to the filter definition in the righthand pane of the Search window:
    Find Perform
    which has related Paragraph (as Called Paragraph) 
    which is in list 
        General.Matched Paragraphs
  9. Execute the search. Interactive Analysis displays a dialog box with the results of the search operation. Click OK. The Search window is dismissed and the results of the search are displayed in the List view.
    Tip: As a practical matter, you would probably also want to search for GO TO statements that reference the duplicate paragraphs. You could simply add the results of this search to the results of the search for PERFORM statements by using the Accumulate Search Results button.