RPGIV @ Work

A unique site for RPG and System i Lovers


Hi, this site will provide all what you need in System i and RPG developments.

My Name is Chamara Withanachchi, System i Expert and RPG Developer. And in the field for last 11 years.

I hope you will find lot of valuable information from this site

A Helpful Tool for Dealing with Unexpected Problems Print E-mail
User Rating: / 0
Written by Chamara Withanachchi   
A Helpful Tool for Dealing with Unexpected Problems

A message on the QSYSOPR message queue is rarely good news. It means I've got to stop what I'm doing and deal with a problem. (I am proud to say, however, that I do bear bad news much better than Monsieur Dreyfus did.)

When dealing with an unexpected problem, several questions must be addressed:

  • What went wrong?
  • What caused the problem?
  • How do we fix it?
  • How do we recover?

One good but underused investigation tool is CL's Start Service Job (STRSRVJOB) command. STRSRVJOB allows you to see a program's data values, and under certain conditions, the program's source code, before you cancel the program. Here's an example.

Suppose the following message shows up on the system operator message queue:

Decimal-data error occurred (C G D F).

The first thing to do is to determine the identifiers of the job that is in error. There are several ways to do this, but one easy one is to place the cursor on the error message, press F1 (for help text), then F9 (to display the message details). The "From job" field tells the job name, user name, and job number.

From a CL command line, run STRSRVJOB.


Use Work with Job (WRKJOB), option 11, to find the name of the program that has halted.


Next, start the debugger, referencing the program name.


Depending on how the program was compiled, you may or may not see the source code. The big advantage to seeing the code is that you immediately determine the location of the error.

Whether the source code is visible or not, you can use the debugger's EVAL command to view the values of fields and variables. If the source code is visible, you can also use the F11 key to display data values.

When you have finished your investigation, run the End Debug Mode (ENDDBG) and End Service Job (ENDSRVJOB) commands to tidy up.

<Previous   Next>