Debug using the Command window

In the previous debugging session, you set breakpoints and monitored values using the CodeWatch GUI. You can also carry out those commands in the Command window as well as more complex debugging tasks: for example, the Watch command enables you to pause execution of the program whenever the value of a particular variable changes, and the Step command enables you to configure a set number of statements to execute before stopping.

  1. In PL/I Explorer, submit the JCL file to the PLIDEMO server again.
  2. When CodeWatch starts, click View > Command window.
  3. Set the same watchpoints as before: in the text entry box at the bottom of the Command window, type the following.
    Tip: The text entry box is the white space at the bottom of the window.
    press Enter, then type
    and press Enter again.

    You can view a list of all watchpoints by entering LWATCH /ALL.

  4. Set the same breakpoints as before. To do this in the Command window, enter these commands:
    You can view a list of all watchpoints by entering:
  5. Type CONTINUE and press Enter. The program starts executing and stops when it reaches a conditional statement or the value of a variable changes. When it stops, the Command Window displays the current values of all watched variables.
  6. Type STEP IN and press Enter. The next line of code executes, and the Command window displays the resulting values of all watched variables.
  7. Use Continue and Step commands a few more times to monitor changes in the values of the watched variables, then type NWATCH /ALL and press Enter to remove all watchpoints.
  8. Set a breakpoint on the last line of the program by entering BREAKPOINT 176.
  9. Type CONTINUE and press Enter.
    When the debugger reaches the END statement, you can find the final values of any variables using the Evaluate command. For example type EVALUATE SYSIN_NUM_RECS and press Enter to confirm that the program has processed five records. This command can be shortened to Ev. For example:
  10. Type CONTINUE and press Enter to complete the program, close CodeWatch, and return to Eclipse.