E-Police home | Easy400 | System i home
Freeware
 
Introduction
Program Error Monitor
Receive Message Queue
Mandatory Activities
Command EDBG
 
Download
 
 

 
  Program error monitor
by Giovanni B. Perotti (Italy)
Program Error Monitor allows developers to be immediately aware of malfunctions occurring in their programs and provides them with the documentation needed to understand the cases and to start providing fixes.

When a program error occurs

  1. a message is displayed to the end-user
  2. an e-mail message is sent to the appropriate developer, with some indications about the error
  3. the message sent also allows to display via HTTP the joblog and the source of the failing program
Note- This support is available only for ILE-RPG programs.
1- Program Error Monitor set up
The following data base file must be populated with local information.
Use STRDFU option 5 (Update data using temporary program) to maintain data.
  • File EPOLICEDTA/LIBRARIES
    For each application program library enter (see Figure 1):
    • the library name
    • the developer's name
    • the developer's e-mail address
    Note 1- You can enter multiple records (multiple developers) for a given application program library.
    Note 2- You do not have to specify all the application program libraries. You may enter *ALL (uppercase, please!) as an application program library name. When a program error occurs for a program belonging to a library not documented in this list, it will default to application library name *ALL.
    Note 3- You can enter multiple records (multiple developers) also for application program library *ALL.
2- ILE-RPG programs setup
The ILE-RPG program/module sources adopting this tool, must:
  1. include the following statements (see figure 2 as an example):
    • in each file specification, add the keyword
      infsr(*pssr)
    • after the file specifications, add the following statements
      /COPY EPOLICE/QRPGLESRC,Q_USEC
      /COPY EPOLICE/QRPGLESRC,Q_PSDS

      See figure 2 as an example.
    • at the end of the source
      /COPY EPOLICE/QRPGLESRC,Q_PSSR
    These statements generate a Program Error Subroutine (*PSSR), which receives control in case of program error. See later for the behavior of this subroutine.
  2. be compiled with the following parameter:
    • for ILE-RPG modules and ILE-RPG bound programs
      OPTION(*SRCSTMT)
    • for SQL-RPG modules or programs
      COMPILEOPT('OPTION(*SRCSTMT)')
3- E-Police program error subroutine (*PSSR) - How it works
The following is about the E-Police program error subroutine *PSSR that you may add (see above) to your ILE-RPG programs.
This is just for your information, no action from your side is required.

The E-Police program error subroutine *PSSR calls program EPOLICE/Q_FILEERR which does the following:

  1. The joblog level is changed to (4 0)
  2. A program error information record is added to file EPOLICEDTA/ERRORS. The information includes:
    • system name
    • timestamp of when the error occurred
    • qualified job name
    • qualified name of the program in error
    • qualified name of the source member the program was compiled from
    • number of the program statement in error (see compile options above)
    • name of the file where the last I/O was performed
    • ID and text of the error message
    • full program status data structure
  3. A notification of the program error is sent to the user:
    • if the program is running under HTTP, an HTML page is sent to the remote browser (see figure 3)
    • if the program is running in interactive mode, a display file screen is sent to the display file device (see figure 4)
    • if the program is running in batch mode, a break message is sent to the job user profile message queue (see figure 5) and a program message is sent to the *EXT message queue (so that it is displayed in the joblog).
  4. An e-mail message is sent to the program developer(s), according to the data found in file EPOLICEDTA/LIBRARIES. See the example in figure 6.
    Acting from the e-mail message, the developer may then display via HTTP
    1. the joblog (see figure 7)
    2. the program source (see figure 8).
4- Examples
As examples, after adding a developer record for library EPOLICE to file EPOLICEDTA/LIBRARIES (also a record for library *ALL is OK), try to run
  • program EPOLICE/SAMPLE1 (see figure 8)
  • or program EPOLICE/SAMPLE2 (see figure 9).
You may run them in interactive mode, in batch mode and even under HTTP (e.g. http://.../epolicep/sample1.pgm ).
See what happens.
Note- Program SAMPLE1 tries to divide by zero, while SAMPLE2 tries to write a duplicate key record to a database file.
5- Useful commands
Some useful commands within the EPOLICE Program Error Monitor:
  • Command EPOLICE/RCVJL (receive joblog) receives the joblog entries of an active job into file QTEMP/JLOG (which is automatically created). It could be useful for other local applications.
    Contact