Previous Topic Next topic Print topic


Debugging an Application

This part of the CICS tutorial shows how to use a debugger to walk through an employee directory PL/I sample application. It explains pertinent parts of the application and debugger functionality.

Before you start debugging, connect to the enterprise server using a TN3270 emulator such as Micro FocusRumba. Your host name is localhost, and the port number is 5150. This tutorial assumes that you are using Rumba for hosting.

Logging in and starting the application in CodeWatch Debugger

  1. Start Micro FocusRumba and create a new mainframe display.
  2. Choose Connection > Connect. The Signon to CICS screen appears in the mainframe display.
  3. Type a user ID and password. These would typically be SYSAD and SYSAD. Press the Tab key to move from the ID field to the Password field.
  4. Press Enter.
  5. Press Ctrl + Shift + Z to clear the screen if using Micro Focus Rumba. If using a different terminal emulator, follow instructions for that emulator to clear its screen.
  6. Type TTEA and press Enter to start the sample application. A message appears asking you if you want to debug the PL/I program STAFF02. To see data returned by the program while stepping through code, data must be supplied. At this point, since no data has been supplied to the program, Click No to return to the application.
  7. In the Name field type WILLIAMS and press Enter. A message appears asking if you want to debug the PL/I program STAFF02.
  8. Click Yes. The CodeWatch debugger window appears. The debugger displays the STAFF02 program and moves to the first line of the program code. If using Rumba to connect to the enterprise server, a Rumba terminal log window also appears.

Stepping through the CICS mapset in the STAFF02 Program

The code for the STAFF02 program receives data from the CICS mapset. This part of the tutorial steps through to where data gets received from the mapset.

  1. Choose View > Show Line Numbers to display line numbers in the CodeWatch debugger.
    Note: You need to have the line numbers displayed to follow the instructions in this tutorial.
  2. Press or F10 several times until you step to the line that shows the following:
    244:       EXEC CICS RECEIVE MAPSET('OCMCS')                                

    This line indicates that the program receives data from the data from the CICS mapset.

  3. Press F10. The debugger steps to line 248. Move the cursor over the text RC. The tooltip displays RC=0{fixed binary(31)} which indicates the mapset is successfully retrieved.
  4. Press F10 to step to line 256 and move the cursor over the text NAMEDI. The tooltip displays WILLIAMS.
  5. Press F10 several times until you reach line 313. This line writes the processed input data (WILLIAMS) to CICS temporary storage.
  6. Press F10 to step to line 322. Move the cursor over the text RC on the line. The tooltip displays RC=0{fixed binary(31)}, which indicates that the program successfully writes the processed input data to a CICS temporary data queue.
  7. Press F10 to step to line 330. This line calls the program STAFF03.
  8. Press F10 to step into STAFF03. The CodeWatch debugger stops and a message appears asking you if you want to debug the PL/I program STAFF03.
  9. Click Yes. CodeWatch reappears and highlights the first line of STAFF03.

Stepping through the CICS mapset in the STAFF03 Program

  1. Choose View > Show Line Numbers to display line numbers in the CodeWatch debugger.
    Note: You need to have the line numbers displayed to follow the instructions in this tutorial.
  2. Press F10 several times to step to line 128, which shows the following.
    128:   CALL READ_QUEUE;   
    This line reads a record from the temporary data queue.
  3. Press or F11 to step into the procedure started on line 128. This steps to line 672, which starts a procedure to read the queue that contains in which the processed input data (WILLIAMS) is stored.
  4. While still stepped to line 672, move the cursor over the text DDP_STRUCA on line 677. Notice that LAST NAME doesn't contain WILLIAMS.
  5. Press F10 to step to line 681.
  6. Move the cursor over RC and check if the tooltip displays: RC=0{fixed binary(31)}.
  7. Move the cursor back over DDP_STRUCA on line 677. The record now contains WILLIAMS.
  8. Press F10 to continue stepping until you return from the procedure and are on line 144. This line calls the STAFF04 program, which reads the file to determine if WILLIAMS is present.
  9. Press or F11 to step into STAFF04.
  10. Scroll to line 529 and double click to set a breakpoint, then press to stop program execution at line 529 where you set the breakpoint.
  11. Press or F11 to step into the READ RECORD procedure.
  12. If you continue stepping, you will see that as you keep reading records, none of them match on WILLIAMS.

You can repeat the steps above using a different last name. You can type for example CH in the last name field and you will see valid records being found in the PROCESS_DATA procedure.

You can also use the debugger's Go to line function to skip the code matching on the last name and thus make it "think" it found a matching record and cause it to be displayed. You can access the Go to line function from the context menu when you right-click the line you want.

Note: For more information on debugging with Java CodeWatch, see Tutorial: Using Java CodeWatch.
Previous Topic Next topic Print topic