635 pts.
 Diverting messages from a given message queue to QSYSOPR
Hi, Can anyone know how to divert messages from a given message queue to Qsysopr. Thanks Siddharth

Software/Hardware used:
ASKED: April 20, 2009  11:55 AM
UPDATED: April 23, 2009  3:04 PM

Answer Wiki:
If I remember right, you can create a CL program to receive the messages for that message queue and send them on to Qsysopr. Then you attach the program to the message queue that you want to monitor. In the program you would use the RCVMSG command to get the messages sent to the queue, then use the SNDMSG command to forward them on to Qsysopr. The command to assign the program to the message queue is: CHGMSGQ MSGQ(xxxx) DLVRY(*BREAK) PGM(pgmlib/pgmname) Hope this helps.
Last Wiki Answer Submitted:  April 21, 2009  1:16 pm  by  Vatchy   1,410 pts.
All Answer Wiki Contributors:  Vatchy   1,410 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

Hi,

Thnks for the response.

But i am confused why do we need a Program to attach. I hope you didnt misunderstand Qsysopr as User profile. It is a Message Queue.

Thanks again,
Siddharth

 635 pts.

 

Hi Siddharth,

The reason that you need the program is to receive the message (and the details of the message) and to re-send it to your other message queue. Unfortunately there’s no OVRMSGQ command to achieve this, so you have to use a program.

This isn’t about user profiles, only message queues.

You don’t attach the program to the message queue, you need to have the program running (normally as a batch job) – the program waits for a message to appear on QSYSOPR using the RCVMSG command, when a message appears on QSYSOPR the program receives the message details, then sends the message to your other message queue. You can specify whether or not to remove the received message on the RCVMSG command.

Hope this helps.

Regards,

Martin Gilbert.

 23,625 pts.

 

Hi,

My post should read that the program sits on your other message queue waiting for a message to send to QSYSOPR, not the other way around. Diverting a message to QSYSOPR should work the same as diverting a message to any queue – the program waits for a message, receives it and then sends it to the other queue.

Regards,

Martin Gilbert.

 23,625 pts.

 

I agree that you don’t HAVE to have the program attached to the message queue but, if you do, you don’t have to worry about submitting the program to batch or the program ending and nobody noticing. If you attach the program to the message queue then all messages will be forwarded automatically.

 1,410 pts.

 

Hi,

There’s another reason why I suggest to use the program as a batch program – I believe that if you use the CHGMSGQ command this only stays in effect for the duration of your job. Once you sign-off, the program is no longer attached to your message queue.

Regards,

Martin Gilbert.

 23,625 pts.