Exercise 5.11: Setting watch breakpoints

Before you begin, you must complete Exercise 5.10: Adding a memory monitor.

A watch breakpoint provides a notification to the user when a variable changes. It will suspend the execution of the program until an action is taken.

To set a watch breakpoint:

  1. Go to the Line number field at the bottom of the source area. In this field enter 118 to go to that line.
    Enter line number
  2. Double-click variable IND-TABLE to highlight it.
  3. Right-click and click Add Watch Breakpoint on the pop-up menu.

    The Add a Watch Breakpoint window opens. The Expression field is pre-filled with the highlighted variable IND-TABLE.

    By default the Number of bytes to watch field is set to zero, which means the variable will be watched in its defined length.
    Add Watch Breakpoint

  4. Click Finish.

    The watch breakpoint is now set.

  5. Click the Resume button on the Debug toolbar.

    The application waits for input from the 5250-emulation session.
    5250-emulation session

  6. In the 5250 emulation session, type 123 for Project Code and D (for delete) in the Action Code field.
  7. Press Enter. A message is displayed indicating that the variable IND-TABLE has changed.
    Watch breakpoint message
  8. Click OK.
  9. In the Breakpoints view, right-click the Watch breakpoint and click Disable on the pop-up menu.

You have added a watch breakpoint for the variable IND-TABLE and run the program to see the notification that the variable has changed and you are ready to begin Exercise 5.12: Closing the debug session.