Debug opdemo.pli

When the PL/I perspective switches to the debug perspective, the source file opdemo.pli should automatically display with the OPDEMO: PROC(JCLPARM) OPTIONS(MAIN) REORDER; line highlighted as the current line of execution.

  1. If line numbers are not turned on in the source window, right-click in the left column of the source pane and select Show Line Numbers.
  2. Click or press F5 to step into the program. This takes you to line 77 that reads:
    on error begin;
  3. Double-click the line or click Run > Toggle Breakpoint to set a breakpoint. The line appears in the Breakpoints pane in the top right part of the debug perspective.
  4. Click two more times to get to the line that reads:
    ON ENDFILE (SYSIN)
  5. Hold the mouse pointer over SYSIN and the following displays as a Text Hover:
    OPDEMO, SYSIN FILE RECORD INPUT  ENVIRONMENT(FB RECSIZE(80)); Refs=4.
  6. Right-click SYSIN and select Inspect item or use Ctrl+Shift+I to inspect the variable.
  7. Click Add to Expressions View and SYSIN and its current value appear in the Expressions pane.
  8. Click two more times to get to the line that reads:
    SYSPRINT_BUFF = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' || /* 26 */
  9. Add it to Expressions pane as you did with SYSIN and check its current value.
  10. Click and see how the value of SYSPRINT_BUFF changes to ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ12.
  11. Click a few more times until you reach the line that reads:
    sysin_num_recs = '0';

    This line initiates the SYSIN_NUM_RECS variable.

  12. Add SYSIN_NUM_RECS to the Expressions pane and notice that its value is pU.a.
  13. Click and check the value of SYSIN_NUM_RECS in the Expressions pane. It has changed to 0000.
  14. Click a few more times until you reach the line that reads:
    sysin_num_recs = sysin_num_recs + 1;
  15. Step into it and notice how the value changes to 0001.
  16. Go to the last line of opdemo.pli where the END statement is and put the cursor on it.
  17. Click (or CTRL+R) to run the program to that line.

    When the debugger reaches the END statement, you can see from the final value of SYSIN_NUM_RECS (0004) that the program has processed five records.

  18. The debugging will end automatically when the program is done running. If you want to stop debugging before that, click .