Example of Setting a Watch Condition

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

WATCH SALARY

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

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

Figure 117. Example of Message Stating WATCH was Successfully Set
                                Display Module Source
 Program:   PAYROL           Library:   MYLIB       Module:  PAYROLL
     52  C                   eval      cnt = 1
     53  C                   dow       (cnt < EMPMAX)
     54  C                   eval      Pay_exmpt(cnt) = eflag(cnt)
     55  C                   eval      cnt = cnt + 1
     56  C                   enddo
     57  C
     58  C                   eval      index = 1
     59  C                   dow       index <= cnt
     60  C                   if        Pay_exmpt(index) = 1
     61  C                   eval      SALARY = 40 * Pay_wage(index)
     62  C                   eval      numexmpt = numexmpt + 1
     63  C                   else
     64  C                   eval      SALARY = Pay_hours(index)*Pay_wage(index)
     65  C                   endif
     66  C                   eval      index = index + 1
     67  C                   enddo
                                                                  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 65, variable: SALARY

In the first two cases, the stopped statement number is passed. In the third case, the stopped MI instruction is passed. The information is displayed at the bottom of a blank Display Module Source display as shown below. Instead of the line number, the statement or the instruction number is given.

Figure 118. Example of a Display Module Source Panel
                                Display Module Source
 (Source not available)
 F3=End program  F12=Resume  F14=Work with module list  F18=Work with watch
 F21=Command entry  F22=Step into  F23=Display output
 Watch number  1 at instruction 18,  variable: SALARY


[ Top of Page | Previous Page | Next Page | Contents | Index ]