ILE C/C++ Programmer's Guide


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 as shown:

+--------------------------------------------------------------------------------+
|                                Display Module Source                           |
|                                                                                |
| Program:   PAYROL           Library:   MYLIB       Module:  PAYROLL            |
|     52  for  (cnt=0;                                                           |
|     53        cnt<EMPMAX &&                                                    |
|     54          scanf("%s%s%f%d%d", payptr->first, payptr->last,               |
|     55                 &(payptr->wage), &eflag, &(payptr->hrs))!=EOF;          |
|     56        cnt++, payptr++)                                                 |
|     57  {                                                                      |
|     58     payptr->exempt=eflag;                                               |
|     59  }                                                                      |
|     60  empsort(payfile, cnt);                                                 |
|     61  for  (index=1, payptr=payfile; index<=cnt; index++,payptr++) {         |
|     62    if  (payptr->exempt==1) {                                            |
|     63        salary = 40*(payptr->wage);                                      |
|     64        numexempt++;  }                                                  |
|     65    else                                                                 |
|     66        salary = (payptr->hours)*(payptr->wage);                         |
|                                                                  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  64, variable: salary                                  |
+--------------------------------------------------------------------------------+

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.

+--------------------------------------------------------------------------------+
|                                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                           |
+--------------------------------------------------------------------------------+

The following programs cannot be added to the ILE debug environment:

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 above. Instead of the line number, the statement or the instruction number is given.


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