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 GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png 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 GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png 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 GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png 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 GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png and see how the value of SYSPRINT_BUFF changes to ABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZABCDEFGHIJKLMNOPQRSTUVWXYZ12.
  11. Click GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png 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 GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png and check the value of SYSIN_NUM_RECS in the Expressions pane. It has changed to 0000.
  14. Click GUID-445E85E7-CCF8-476F-84AC-7BC730033099-low.png 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 GUID-45D4F88D-0661-4E6D-9AEB-D1C9098AC33D-low.png (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 GUID-0FAE515D-4283-47C9-873C-F831E21E5338-low.png.