Troubleshooting and debugging a host program

After you have completed portions of your Web application, you can test it in the WebSphere Test Environment. During run time several messages are displayed in the console view. When the first Web interaction runs that calls a host program, an iSeries job is created. Subsequent interactions use that job. In the console view in the IDE, you see a message similar to the following example that shows the qualified job name:
[6/20/03 10:17:14:203 EDT] 4d902d5d SystemOut     O iSeries host job id [964671/QUSER/QZRCSRVS]
These jobs run in the QUSRWRK subsystem. To view the job log:
  1. Enter the iSeries command WRKACTJOB SBS(QUSRWRK).
  2. Press F11 to get the view that shows the job number.
  3. Select option 5.
  4. Select option 10.
You can also view the job log through the Remote System Explorer perspective within the IDE:
  1. If a connection does not already exist, create one. Expand the connection.
  2. Expand iSeries jobs.
  3. Expand Active Jobs.
  4. Locate the job in the view then right-click and select Display job log.
In addition to the job log, you can also see job information in the console similar to the following example:
6/20/03 13:08:47:190 EDT]  8780775 SystemOut     O  starts preprocessing action [enterordersAction]
[6/20/03 13:08:47:190 EDT]  8780775 SystemOut     O
         Form EnterordersInputForm data {
         [custno] = {[0001] }
}
This information indicates that a Web interaction named enterorders is invoked when OK is pressed on the Web page. This Web page has one field named custno and its value is 0001. This is the value that is being passed to the host program. When the program returns, you will see the resulting values in a message similar to the following. This shows the iSeries qualified job name as well as the program alias defined in the Web interaction, followed by the values of the return parameters.
[6/20/03 13:08:50:034 EDT]  8780775 SystemOut     O iSeries host job id [964716/QUSER/QZRCSRVS].
[6/20/03 13:08:50:064 EDT]  8780775 SystemOut     O invoking host program alias [startorder]
[6/20/03 13:08:50:174 EDT]  8780775 SystemOut     O  postprocessing action [enterordersAction]
[6/20/03 13:08:50:174 EDT]  8780775 SystemOut     O
Form EnterordersOutputForm data {
[mainmessage] = {[] }
[state] = {[IO] }
[name] = {[Oakley, Annie O] }
[zip] = {[07891-2345] }
[custno] = {[0001] }
[city] = {[Des_Moines_] }
[addr2] = {[Bldg 00001] }
[addr1] = {[00001 Ave. ABC] }
[ordnbr] = {[4594] }
}
If you have deployed your application to the production WebSphere Application Server, these status messages are in the /log directory of the application installation directory. For WebSphere Application Server V5.0, the log files are in the following location:
/QIBM/UserData/WebAs5/Base/default/logs/server1/SystemOut.log
For WebSphere Application Server V6.0, the log files are in the following location:
/QIBM/UserData/WebSphere/AppServer/V6/Base/profiles/default/logs/server1/SystemOut.log

This assumes that you are using the default WebSphere Application Server instance.

For WebSphere Application Server 5.0 Express, the messages are in the following location:
/QIBM/UserData/WebASE/ASE5/server1/logs/server1/SystemOut.log
For WebSphere Application Server V6.0 Express, the log files are in the following location:
/QIBM/UserData/WebSphere/AppServer/V6/Base/profiles/was6express/logs/server1/SystemOut.log

There may be additional messages in the SystemErr.log file.

  1. You can use the job number to debug your host program assuming that you have compiled the program with debug information:
    1. On an iSeries command line, put the job in service mode by issuing the STRSRVJOB command STRSRVJOB 964716/QUSER/QZRCSRVS.
    2. Run the STRDBG command to put the program into debug mode. If your program has Output or Update capable files, you need to set the UPDPROD keyword to *YES or an error will occur.
    3. When the program source is displayed, press F6 to add a breakpoint to a statement and press F12.
    4. On your Web page, press a button that invokes the procedure being debugged. When the breakpoint is reached, the program source is displayed.
  2. To use RSE to debug:
    1. Locate the job in the Active Jobs view.
    2. Right click the job and select Debug As > iSeries Job.
    3. Press OK when the debug message box is displayed.
    4. On your Web page, press a button to invoke the Web interaction. The debug perspective opens with the program source displayed in the source view.
    5. Add breakpoints where needed by double-clicking the source margin.
    6. Press F8 to resume execution of the program.
  3. In some situations, you can debug from a host program, without an iSeries job running. Use the Remote System Explorer to create a service entry point for the object you want to debug. You can set a service entry point to a procedure, module, or program object. Once you've set a service entry point, any job that performs a program call on that service entry point will start the debugger in the IDE automatically as long as the user ID used in the job is the same as the connection that you used to create the service entry point. Once the debugger has started, you can set break points in the source to do your debugging. To do this, the following must be true:
    1. You must be working with an ILE program or procedure.
    2. It must be compiled with debug data.
    3. You must be using OS/400 V5R2 or later.
Refer to the Integrated iSeries Debugger documentation for more information about debugger features.