I have a compiled CL program that executes an MQ control command using
CALL PGM(QCMDEXC) PARM(&CMDSTR &CMDLEN)
If there is a problem with an MQ control command param, I want to catch the error msg
using the CL command MONMSG MSGID(xxx). Testing shows that msg ID
CPF0006 (command failed) or any other CPF code can be monitored and caught,
but AMQ msg ID's, such as AMQ8168 (User profile name not found), can not.
One web doc I found "Using MQSeries on the AS/400"  has a CL program
example to stop a qmgr example showing this line
MONMSG MSGID(AMQ6906) EXEC(GOTO CMDLBL(LOOP))
that purports to monitor an AMQ message.
Here's an exact sample extract from my CL program:
MONMSG MSGID(AMQ8168) +
EXEC(SNDPGMMSG MSGID(AMQ8168) MSGF(AMQMSG) MSGTYPE(*ESCAPE) +
MSGDTA('User profile name not found RC(AMQ8168)'))
I'm aware that MSGDATA example should have param values to fill in to the actual AMQ msg template,
but the syntax is correct, it compiles ok, but the AMQ msg, though seen in the calling application's
job log, is not caught in the CL program.
Anyone have related experience and the answer?
Is there a CL trick that I'm unaware of?
Any newer references with the answer?
July 1998, pg. 209