Viewing program control flow for a PL/I file

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

About this task

Supported Editors:
  • PL/I Editor
  • z Systems® LPEX Editor

You can run program analysis on a PL/I file while it is in edit mode. After you start the analysis, the Program Control Flow view opens with a hierarchal graph of the parts within the program file. Each node represents a callable statement, such as a program, package, or procedure. The following example shows several procedures. 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: 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 PL/I 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 program and associated packages and procedures in the file. A brief description about the node is given when you hover over it. The description includes the node type, name and line number within the file.

    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 focus the tree diagram on a specific flow, right-click a select node in the diagram. This action is helpful if the program is large because you can focus on a single flow. 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 of 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.

Navigating the flow diagram

About this task

Features on the diagram control area provide zoom in, zoom out, and return to original size. The save feature creates a bitmap of the diagram that you specify where to save it.

Procedure

  • To locate a node by name, use the search field on the diagram control area. In the search field, type the partial or full name of the program, package, or procedure.
  • To navigate the diagram, use the diagram control area.
    • Down arrow icon: Move to next node in the diagram.
    • Up arrow icon: Move to previous node in the diagram.
    • Zoom in icon: Enlarge the diagram.
    • Zoom out icon: Reduce the diagram.
    • Reset zoom icon: Reset the diagram to the original size.
    • Zoom to fit icon: Enlarge or reduce the diagram to fit the size of the Program Control Flow view.
    • Refresh icon: Refresh the diagram.
      Restriction: Refresh does not adjust the diagram when a file is closed, altered so that it no longer matches the diagram, and then reopened. If a PL/I file is closed without also closing the Program Control Flow view, selecting Refresh does not update the diagram. To update the diagram, select Show In > Program Control Flow.
    • Save as icon: Create a bitmap of the diagram that you specify where to save it.