Use QSYSMSG message queue

QSYSMSG is a queue that you can create if you plan to handle the list of serious messages that are sent to the queue.

The QSYSMSG message queue is an optional queue that you can create in the QSYS library. If it exists and is not damaged, certain messages are directed to it instead of, or in addition to, the QSYSOPR message queue. This allows a user-written program to gain control when certain messages are sent. You should not create the QSYSMSG queue unless you want it to receive specific messages.

Enter the following command to create the QSYSMSG queue:

CRTMSGQ  QSYS/QSYSMSG +
         TEXT('Optional MSGQ to receive specific system messages')

Once the QSYSMSG message queue is created, all of the specific messages are directed to it. You can write a program to receive messages for which you can perform special action and send other messages to the QSYSOPR message queue or another message queue. This program should be written as a break-handling program.

Related reference
Messages sent to QSYSMSG message queue