IBM AS/400 Frozen Dessert Maker User Manual


 
Example of Setting a Watch Condition
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 91.
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
57C
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
Figure 91. Example of Message Stating WATCH was Successfully Set
The line number of the statement where the change to the watch variable was
detected is highlighted. This is typically the first executable line
following
the
statement that changed the variable.
A message indicates that the watch condition was satisfied.
Note: If a text view is not available, a blank Display Module Source display
is shown, with the same message as above in the message area.
The following programs cannot be added to the ILE debug environment:
1. ILE programs without debug data
2. OPM programs with non-source debug data only
3. OPM programs without debug data
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.
Chapter 11. Debugging Programs 193