Viewing program control flow for a COBOL file

Program control flow provides a graphical view of the logical flow within a COBOL program. You can use this feature to identify potential logic problems or locate code that is not being used.

About this task

Supported Editors:
  • COBOL Editor
  • z Systems® LPEX Editor

You can run program analysis on a COBOL file while it is in edit mode. After you start the analysis, the Program Control Flow view opens with a hierarchical graph of the parts within the program file. Each node represents a callable statement, such as a section or paragraph. The following example shows several paragraphs. To navigate from one node to another, click the node in the tree. The corresponding code is visible and highlighted in the file.

Figure 1. Example of program control flow diagram
Program analysis data of the Global Mart sample
Restriction: This feature has several restrictions:
  • The program control flow diagram does not display control flow nodes for control transfers that are generated by the following statements:
    • EXEC CICS HANDLE
    • EXEC CICS IGNORE
    • EXEC CICS PUSH
    • EXEC CICS POP
    • EXEC SQL WHENEVER
    • FUNCTION
  • Quick fix is not available.
  • On Windows platforms, you can save diagrams in Scalable Vector Graphics (SVG) format or Portable Network Graphics (PNG) format. On macOS, you can save diagrams in SVG format.

Procedure

  1. Open a COBOL file in the editor.
  2. Right-click in the file to open the menu.
  3. Click Show In > Program Control Flow.
    The Program Control Flow view opens with a diagram that shows the paragraph sections in the file. A tooltip opens for the node when you hover over it. The description includes the paragraph name and line number of the paragraph.

    If there is a comment in the code associated with the node, the comment is displayed as well. You can scroll through the comments, or click the comment box to edit them. To close the comment box, click outside the box or hover over another node.

  4. To view the flow further, right-click a node in the diagram. You can narrow the tree diagram to information about a specific node. This action is helpful if the program is large because you can focus on a single paragraph. Click one of the following options.
    • Show Program Control Flow from Here: Displays the code that is called from the selected node.
    • Show Program Control Flow to Here: Displays the code that calls the selected node.
    • Show Program Control Flow from Here to: Displays the Show Program Control Flow from Here to dialog, which consists the name of the "from node", a list of the nodes that are valid to be selected (nodes that are called by the "from node" directly or indirectly), and a text field for you to search the "to node".
    • Show All: Displays all procedures in the code.
    • Hide Exit Nodes: Removes the display of exit nodes in the diagram.