To set a COBOL watchpoint in native COBOL code

Restriction: The following applies to native code only.

COBOL watchpoints are a type of breakpoint for native COBOL code that you set on individual data items (not on lines of code). They enable you to watch an area of memory associated with the particular item, and whilst debugging, execution breaks each time the associated memory is updated, or if a condition is attached to the data item, when the condition and/or hit count setting is satisfied. You can set COBOL watchpoints either before you start to debug or during your debug session.

To add a COBOL watchpoint:

  1. Click Debug > Windows > Watchpoints to display the Watchpoints window.
  2. Click New.
  3. Type the name of a data item in the field and press Enter.
    Shortcut: From the editor, right-click a data item in the source code and select Add COBOL Watchpoint.

    The watchpoint is listed in Watchpoints window, and is enabled by default (as indicated by The Check mark icon to its left). You can toggle this watchpoint on and off by clicking The Check mark icon.

  4. To add a condition to the watchpoint (optional):
    1. Right-click the data item in the Watchpoints window and select Conditions.

      The Watchpoint conditions dialog box appears.

    2. Select Conditions, and then add one or both of the following:
      • An expression: a conditional expression, such as variable EQUALS value. (Bear in mind that 'Breaks when' is prefixed to your expression to form the complete expression. Also, there is no syntax validation of your expression; if it is syntactically incorrect, it just won't work.)
      • A hit count value: this represents the number of times that the area of memory is updated; click the current hit count criteria and select from the list of criteria displayed, and then enter the appropriate value.

      If you define both an expression and a hit count value, both criteria must be satisfied before execution will halt.

  5. Click OK.

    The COBOL watchpoint is displayed in the Watchpoints window, and is enabled for any subsequent debugging session until you disable it (clear The Check mark icon to the left of the name) or delete it.

    When the watchpoint is enabled, debugging stops on the line that immediately follows the line on which the data has changed.