Characteristics and Limitations Of Watches

When using watches, keep the following watch characteristics in mind:
  • Watches are monitored on a system-wide basis, with a maximum number of 256 watches that can be active simultaneously. This number includes watches set by the system.
    Depending on overall system use, you may be limited in the number of watch conditions you can set at a given time. If you try to set a watch condition while the maximum number of active watches across the system is exceeded, you will receive an error message and the watch condition is not set.
    Note: If a variable crosses a page boundary, two watches are used internally to monitor the storage locations. Therefore, the maximum number of variables that can be watched simultaneously on a system-wide basis ranges from 128 to 256.
  • Watch conditions can be set only when a program is stopped under debug, and the variable to be watched is in scope. If this is not the case, an error message is issued when a watch is requested, indicating that the corresponding call stack entry does not exist.
  • Once the watch condition is set, the address of a storage location that is watched does not change. Therefore, if a watch is set on a temporary location, it could result in spurious watch-condition notifications.

    An example of this is the automatic storage of an ILE C/C++ procedure, which can be reused after the procedure ends.

    A watch condition may be triggered even though the watched variable is no longer in scope. You must not assume that a variable is in scope just because a watch condition has been reported.

  • Two watch locations in the same job must not overlay in any way. Two watch locations in different jobs must not start at the same storage address; otherwise, overlap is allowed. If these restrictions are violated, an error message is issued.
    Note: Changes that are made to a watched storage location are ignored if they are made by a job other than the one that set the watch condition.
  • Eligible programs are automatically added to the debug session if they cause the watch-stop condition.
  • When multiple watch conditions are hit on the same program statement, only the first one will be reported.
  • You can set watch conditions when you are using service jobs for debugging, that is when you debug one job from another job.
  • If a program in your session changes the content of a watched storage location and a watch command is successfully run, your application is stopped and the Display Module Source display is shown.
    If the program has debug data and a debug view is available, the debug data is shown. The source line highlighted is the next statement to run (after the statement that changed the storage location). A message indicates which watch condition was satisfied.
    Note: If the program cannot be debugged, the text area of the display is blank.