Example of Setting a Watch Condition

In this example, you watch a variable kount in program MYLIB/PAYROLL. To set the watch condition, type:

WATCH kount

on a debug line, accepting the default value for the watch-length.

If the value of the variable kount changes subsequently, the application stops and the Display Module Source display is shown, as illustrated in Figure 42.

Figure 42. Example of Message Stating WATCH Was Successfully Set
                             Display Module Source
  Program:   PAYROLL          Library:   MYLIB       Module:  PAYROLL
      42        * THE FOLLOWING 3 PARAGRAPHS CREATE INTERNALLY THE  *
      43        * RECORDS TO BE CONTAINED IN THE FILE, WRITES THEM  *
      44        * ON THE DISK, AND DISPLAYS THEM                    *
      45        *****************************************************
      46         STEP-2.
      47             ADD 1 TO KOUNT, NUMBR.
      48             MOVE ALPHA  (KOUNT) TO NAME-FIELD.
      49             MOVE DEPEND (KOUNT) TO NO-OF-DEPENDENTS.
      50             MOVE NUMBR          TO RECORD-NO.
      51         STEP-3.
      52             DISPLAY WORK-RECORD.
      53             WRITE RECORD-1 FROM WORK-RECORD.
      54         STEP-4.
      55             PERFORM STEP-2 THRU STEP-3 UNTIL KOUNT IS =
                                                                    More...
  Debug . . .  ___________________________________________________________
  ________________________________________________________________________
  F3=End program  F6=Add/Clear breakpoint  F10=Step  F11=Display variable
  F12=Resume      F17=Watch variable  F18=Work with watch  F24=More keys
  Watch number  1 at line 55, variable: KOUNT
Figure 43. Example of a Display Module Source Display
                               Display Module Source
  Program:   PAYROLL        Library:   MYLIB          Module:  PAYROLL
    (Source not available.)











                                                                 Bottom
  Debug . . .  ___________________________________________________________
  ________________________________________________________________________
  F3=End program  F6=Add/Clear breakpoint  F10=Step  F11=Display variable
  F12=Resume      F17=Watch variable  F18=Work with watch  F24=More keys
  Watch number  1 at instruction 18, variable: KOUNT