Viewing a COBOL program structure

Use the Open Perform Hierarchy action to see the structure of a COBOL program.

About this task

Results from Open Perform Hierarchy are available in the Perform Hierarchy view. The Perform Hierarchy view is a tree graphic that displays paragraph and line numbers for each statement in the hierarchy. By using this view, you can navigate among those statements as shown in the following graphic.

Example of Perform Hierarchy view

Each paragraph is identified by an icon (Paragraph icon). The paragraph icon can contain decorators that provide more information about the paragraph.

Exclamation point
Indicates conditional processing.
Flag
Indicates loop processing, such as self referencing GO TO statements.
Exception
Indicates that an exception occurred.

Procedure

  1. In the editor, select the element that you want to view.
  2. Right-click the selection, and select Open Perform Hierarchy.
  3. Click the Perform Hierarchy tab to see the results.
  4. In the Perform Hierarchy view, you can choose these actions from the drop-down menu:
    • Show the performer hierarchy or the performee hierarchy.
      Taskbar icon to view Performee HierarchyPerformer Hierarchy
      Displays all elements that can transfer control to the selection. For example, given the paragraph "Copy-input-to-output," the Performer Hierarchy displays all paragraphs and sections that can transfer control to that paragraph with a statement such as Perform Copy-input-to-output.
      Taskbar icon to view Performer HierarchyPerformee Hierarchy
      Displays all elements that are referenced from the selection. For example, given the Copy-input-to-output paragraph, the Performee Hierarchy displays a statement that can transfer control outside of the selection paragraph with statements such as Perform Read-next-input-data. Because perform hierarchies can be nested arbitrarily, the Perform Hierarchy is a tree view that you can use to traverse this hierarchy.
    • Calculate fall-through. The Calculate Fall Through action provides a possible logic path that is based on potential fall through in paragraphs and sections. You might see false positives in the results.
    • Filter the amount of information that is displayed. These filters are available:
      • Hide EXIT Paragraphs
      • Hide CALL statements
      • Hide STOP RUN statements
      • Hide GOBACK statements
      One or more filters can be selected concurrently. The filters work like a toggle switch; when a filter is on, a check mark is displayed next to the name. To clear the filter, click the filter name. The display changes dynamically when the filter is changed.

Examples

Following is an example of COBOL code with the performee highlighted:

* ****************************************************************************
* Utility method for copying input data from the input file to the output file
* ****************************************************************************
  Copy-input-to-output.
* Loop until end of file for input file
     Move "0" to Input-eof
     Perform until
             NOT inputfile-success OR
             NOT outputfile-success
         PERFORM  Read-next-input-data 
         IF inputfile-success
            PERFORM Write-output-data
         End-IF
         End-perform.
      Copy-input-to-output-EXIT.
         EXIT.

* *******************************************
* Utility method for reading from input file
* *******************************************
  Read-input-data.
*    Assume text to be read into Temp-data from IN-INTERNAL-FILE
     Move Spaces to Temp-data.

In the following example from the same COBOL program the performer is highlighted:

 Procedure DIVISION USING PARMS.
* Open the input and/or output files
     PERFORM Open-files.

* Process the user request

     EVALUATE ACTION
         WHEN DO-COPY-DATASET
             PERFORM  Copy-input-to-output. 
         WHEN OTHER
             CONTINUE.
     END-EVALUATE.
     MOVE IN-FILE-STATUS
          TO PARM-IN-FILE-STATUS.
     MOVE OUT-FILE-STATUS
          TO PARM-OUT-FILE-STATUS.
     MOVE IN-VSAM-CODE
          TO PARM-IN-VSAM-CODE.
     MOVE OUT-VSAM-CODE
          TO PARM-OUT-VSAM-CODE.
     PERFORM Close-files.
     goback.

* ***************************************************
* Utility method to open the input and/or output file
* ***************************************************
  Open-files.
* Open the input file
     OPEN I-O IN-INTERNAL-FILE

Feedback