Tips on Debugging PL/I

Here are some tips and tricks on debugging PL/I applications in the Visual Studio IDE:

Add a Watch
Right-click a variable in the editor and choose Add Watch.
Attach to a Running Process
See To attach to a running process and debug.
Locals window
Displays the variables used in the current statement and enables you to change their values or add watches to them.
Double-click in the left margin of editor next the a line of code, or position the cursor on the line and press F9. You can also choose Debug > Toggle Breakpoint or choose Breakpoint > Insert Breakpoint from the editor context menu.
Breakpoints Window
Displays a list of all breakpoints and tracepoints set in the code. Double-click on a breakpoint in the window to position the cursor on the line for which it has been added.
To add a watchpoint from the editor, right-click a data item and select Add Watchpoint. Alternatively, you can add watchpoints from the Watchpoints window. To disable or remove the watchpoints, choose Debug > Watchpoints > Disable/Delete All Watchpoints.
DataTips and Pin To Source
Provide information about the variables in the source code. To display the DataTip for a variable, you can hover it. This works only in break mode when the execution stops and with variables that are used at run time.

If you need to keep the DataTip for a variable open, right-click on the variable in the code and choose Pin To Source.

Debug Profiles
Available from the Debug tab in the project's properties. PL/I projects can have multiple debug profiles where a debug profile stores a set of properties which specify how to start debugging the application.
Find Symbol Results Window
To display the window, click View > Find Results > Find Symbols Results. Displays the results of Find All References command in the editor. Double-click an item in the list to position the cursor on the line that includes the referenced item.
Memory Window
Allows you to see the contents of memory for a given address. This can be a pointer reference, the address of data-item or an integer value. To display the window, click Debug > Windows > Memory > Memory n. Works for native COBOL only.
Remote Debugging
You can debug a process running on a remote system if the machines are connected using TCP/IP. See Remote Debugging.
Ensure that the local and remote systems are networked using TCP/IP. To connect to the remote machine and debug a program, choose Project > projectProperties and go to the Debug tab. Check Enable remote machine and fill in the name or the IP address of the remote machine and the TCP port number.
Run To Cursor
Right-click a line of code in the editor and select Run To Cursor. This starts a debugging session and executes the code till the line on which you positioned the cursor.
Start Debugging
Choose Debug > Start Debugging or, alternatively, press F5 or F11. F5 starts debugging and runs the application until a breakpoint or an error occurs. F11 starts debugging and breaks on the first statement that can be debugged.
Stop Debugging
Choose Debug > Stop Debugging. You can also click in the Debug toolbar.
Threads Window
Shows all threads that are running in the process. To display the window, choose Debug > Windows > Threads.
Variable Windows
Include windows, such as for example Locals, Quick Watch, Watch, for monitoring and editing values and expressions.
Watch Window
Enables you to watch the values of variables and expressions. To open the window, click Debug > Windows > Watch > Watch n while debugging. To change the format of displaying the values from decimal to hexadecimal, right-lick in the window, and click Hexadecimal Display.

To change the format of display of the values on individual rows in the Watch window, click a row, press F2, and type: Variable,h or Variable,x to always display the values in hexadecimal format; Variable,d to always display the values of variables in decimal format, and of strings - as text.

Watchpoints Window
Enables you to add data items as watchpoints, and monitor their values in a decimal or hexadecimal display. To open the window, click Debug > Windows > Watchpoints.