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

 
  Receive Message Queue
by Giovanni B. Perotti (Italy)
There are installations that are regularly bothered by system messages requiring actions (expecially from message queue QSYSOPR).
In most cases, the causes of the messages are very well known, and the actions are always the same.
Then, why not an automat taking care of these cases and documenting what was done?
1- The Receive Message Queue command
does the job. For a given message queue (usually QSYSOPR) you may
  • define the message IDs that the automat should process
  • define a match pattern on the message data, in order to process only given messages
  • define an answer for inquiry messages
  • run a set of commands, before and/or after a reply (if needed)
  • notify a given user profile - through a break message - of what happened
  • notify a given e-mail address about the actions taken
2- Things to do before running the command
The following assumes that you want to deal with message queue QSYSOPR (for a different message queue, see later in this page).
There are two database files you have to update through STRDFU command (option 5 recommended):
  1. EPOLICEDTA/QSYSOPR
    Enter the following:
    • message id
      the message ID that the automat should process
    • sequence number
      different cases are possible depending on different match patterns (see next).
      This field is used to sequence the possible cases for a given message ID.
    • compare data
      if needed, type a match pattern (string) to be found in the message text
    • compare data offset
      if you specified some compare data, you must then specify the offset of such compare-data string in the message text
    • compare data length
      if you specified some compare data, you must then specify the length of the compare-data string (this is needed, because the compare data could include some trailing blanks)
    • message reply
      the reply that should be given to an inquiry message (usually a single character)
    • commands before/after reply
      commands that should be run.
      For an inquiry message it is possible to run commands before and/or after the reply.
      Commands are mandatory for non-inquiry messages (in this case, specifying them in the "before" or "after" field is the same).
      In these two fields you may enter a sequence of individual commands each ending with character ';' .
  2. EPOLICEDTA/USRPRFMAIL
    Add records to this file only if needed.
    Records in this file do describe the e-mail addresses of given user profiles.
    When command EPOLICE/RCVMSGQ is run, any time an automated reply is processed, the job user profile is searched vs file EPOLICEDATA/USRPRFMAIL.
    An e-mail message is then sent for any record matching the job user profile as search key (this means that you can have multiple people made aware of the actions taken by a reply-message-queue job).
    To add a record, enter the following:
    • User profile
      the user profile (uppercase, please!) matching the user profile of the RCVMSGQ job that will be submitted
    • First name / Last name
      the information needed to make up the e-mail destination address
    • E-mail address
      the e-mail address the message should be sent to.
3- Command EPOLICE/RCVMSGQ
Once entered, this command will start an endless job in subsystem QSYSWRK.
It is up to you to establish how to have this enabled permanently, via an AJE, a scheduled job entry, or anything similar.
Command parameters:
  • Message queue
    the qualified name of the message queue messages should be received from.
    It defaults to QSYS/QSYSOPR.
    However, other message queues can be handled, see later in this page.
  • Workstn to receive messages
    Device name of the workstation device that should also receive a break message any time an automated reply is processed.
    Special values:
    • *CURRENT
      the name of the workstation submitting the request from the interactive environment
    • *NONE
      do not use this feature
4- Message queues other than QSYS/QSYSOPR
It is possible to process in automated mode inquiry messages coming from message queues other than QSYS/QSYSOPR.
In order to do that,
  1. CRTDUPOBJ OBJ(QSYSOPR) FROMLIB(EPOLICEDTA) OBJTYPE(*FILE) NEWOBJ(message_queue-name) DATA(*NO)
  2. Perform what is requested in step 1.a above, but now for file EPOLICEDTA/message_queue-name
    Contact