Program Control Flow Browser

The Program Control Flow Browser provides an interactive graph that visualizes the control flow of a COBOL program. This is an advanced capability available with an active license.

'program-control-flow-sample'

Opening the Program Control Flow Browser

To open a program in the Program Control Flow Browser, it must first be successfully parsed by the language servers. This requires the program to be free of critical syntax errors and for all referenced copybooks or include files to be properly resolved. Any issues that may impede parsing are reported in the Problems viewopen in new window within VS Code, where users can identify and address them accordingly. If a program cannot be parsed, or is still in the process of being parsed, attempting to open it in the Program Control Flow Browser will result in an error message being displayed.

The Program Control Flow Browser can be opened in the following ways:

  • Cmd ⌘/Ctrl + Shift + P to open the command palette and run the command >IBM Z Open Editor: Show in Program Control Flow while viewing a COBOL program.
  • Right-click within a COBOL program and select Show In > Program Control Flow.

Either method is available for local programs or for remote programs accessed through Zowe Explorer or the z/OS Resources Table. The view opens in the VS Code panel by default but can be repositioned to other areas of the editor if required. The view cannot be opened for a copybook or include file.

The graph in the Program Control Flow Browser can be navigated by scrolling horizontally and vertically, or by using arrow keys to move the view in any direction.

Zooming is controlled through a set of buttons located in the bottom-left corner of the graph. These buttons allow zooming in and out of the graph, and a reset button on the far right sets the zoom level to 100%, returning the graph to its default scale.

A caret icon to the left of the zoom controls toggles the visibility of the minimap, which starts collapsed by default. When expanded, the minimap displays a scaled-down overview of the entire graph, and clicking within it will reposition the main graph view to the selected location.

Actions

Each node in the Program Control Flow Browser represents a paragraph, section, or the procedure division within a COBOL program. Clicking a node highlights the corresponding element in the source code, and opens a details panel showing the full name of the paragraph or section (or the program name, if the procedure division node is selected), along with its start and end line numbers in the program.

When a node is clicked, the graph automatically focuses on control flow paths that may transfer control to or from the selected node, while unrelated nodes become slightly transparent.

For paragraph and section nodes, additional actions are available via the overflow menu (three vertical dots) in the top-right of the node:

  • Show Program Control Flow From Here: Displays a graph showing all control flow paths that originate from the selected node. This helps visualize how control progresses through the program from that point.

  • Show Program Control Flow To Here: Displays a graph showing all control flow paths that lead to the selected node. This helps identify potential entry points or calling paths that reach the selected code.

A Reload button is also available in the top-right corner of the browser. Clicking this button will regenerate the graph for the currently opened COBOL program, incorporating any recent edits made to the source code. If a Show Program Control Flow From Here or Show Program Control Flow To Here action has been applied, using Reload will reset the graph to its default state and display all nodes.

Limitations

Support for very large COBOL programs is still a work in progress. In some cases, the Program Control Flow Browser may not display the full control flow accurately, and certain actions may not behave as expected. Improvements to large program support are planned for future updates.

Last Updated:
Contributors: Benjamin Santos