PreviousOverview of PL/I Option Getting Started with PL/I ApplicationsNext"

Chapter 2: Debugging PL/I Applications

Mainframe Express uses the IBM VisualAge PL/I debugger to debug PL/I applications. This chapter introduces the main functions of the PL/I debugger. More details are provided in the chapter Getting Started with PL/I Applications, and comprehensive online help is provided from the Help menu within the PL/I debugger or from the Windows desktop by clicking Start>Programs>Micro Focus Mainframe Express 2.0>IBM VisualAge PLI Help.

When you debug a PL/I application, the source code is displayed as execution proceeds. You can step through the source code and set breakpoints to interrupt execution. When execution stops, the current line is highlighted. You can then, for example, examine and change data items and continue execution.

2.1 Starting the Debugger

You start the PL/I debugger in the usual way, by clicking Start Debugging on the Debug menu. Make sure that Enable PL/I debugging is checked on the Start Debugging dialog box or the PL/I debugger will not be invoked.

The PL/I debugger uses its own windows, outside of the Mainframe Express IDE, to display debugging information and to let you interact with it. If your application contains COBOL or Assembler programs as well as PL/I, the debuggers for these languages could also be invoked during the debugging session.

You can pass parameters to the application in the usual way, which depends on the system environment that is being used.

The PL/I debugger is attached when the first PL/I module is loaded. At this point, execution of the application stops and the PL/I debugger displays two windows:

Initially, the Disassembly window is on top, but the Session Control window is more useful as a starting point for debugging.

In the Session Control window, if you double-click the name of a module, a Source window is displayed, showing the source code for that module. You can display a separate Source window for each module on the list.

The Source window is also displayed automatically when execution stops within a PL/I module. The current statement is highlighted. You can use the View menu to switch between the Source, Disassembly, and Mixed views. The latter combines the information from the other two so that you can see the Assembler code that was generated by the PL/I compiler for each PL/I statement.

You cannot edit the source code directly in the Source window. If you want to change a PL/I program, you should stop debugging, edit the source module, rebuild it and restart debugging.

2.2 Debugger Functions

This section introduces the basic debugging functions that are available with the PL/I debugger. You must control these functions from the PL/I debugger windows and not the Mainframe Express window. The following description assumes that debug information has been generated for all the PL/I modules during compilation.

To begin with, you will probably find it easiest to control the PL/I debugger functions from the Breakpoints, Monitors, and Run menus on the Source window. In fact, several of the functions are available only from these menus on the Source window. Later, you can use pushbuttons or shortcut commands.

Please note the following:

2.2.1 Breakpoints

A breakpoint causes the debugger to stop execution so that you can monitor the application's activity, change data items and control the subsequent execution. On the Breakpoints menu, you can define the following types of breakpoint:

The Breakpoints List window shows all the breakpoints that have been set. To see this window, click List on the Breakpoints menu. You can also modify the breakpoints from this window.

If the application will execute a breakpoint more than once, you might not want execution to stop every time. The Frequency option lets you specify which instances of the breakpoint will stop execution. The Expression option lets you specify a conditional expression which must be true if the breakpoint is to stop execution.

If you want to temporarily disable a line breakpoint without deleting it, right-click the line in the source code and click Disable on the popup menu.

To disable any type of breakpoint, select the breakpoint on the Breakpoints List window then click Disable on the Edit menu.

If you use Close debugger on the File menu to terminate a PL/I debugging session, the breakpoints are retained. In other cases, all breakpoints are deleted at the end of the debugging session.

2.2.2 Monitors

You can request the following windows from the Monitors menu in order to see information about the current status of active procedures and make changes:

2.2.3 Run Commands

When you have defined any breakpoints and monitors that you want, you can use the following commands on the Run menu to continue execution of the application:

2.2.4 Limitation of Step Over and Step Into Commands

When a PL/I program transfers control to another PL/I program (for example, in CICS, by a LINK or XCTL statement) or to another point in the same program (for example, by a GOTO, HANDLE CONDITION, or ABEND statement), the debugger does not stop in response to a Step over or Step into command as you might expect. If you want to continue debugging at the first statement that you might reach in these circumstances, you must place a line breakpoint at that statement. If you do not, and there are no other breakpoints in the execution path, the program runs through to completion. In the case of a CICS transaction, you will need to restart the CICS session in order to resume debugging.

Copyright © 1999 MERANT International Limited. All rights reserved.
This document and the proprietary marks and names used herein are protected by international law.

PreviousOverview of PL/I Option Getting Started with PL/I ApplicationsNext"