MONMSG in CL
MONMSG in CL
MONMSG in CL
MONMSG
The messages are sent to the program message queue for the conditions specified in the
command. If condition exists, the CL command specified on the MONMSG command
runs.
It doesnt handle diagnostic messages but we can receive those messages from the
message queue to get additional information related to the error.
Program level
The MONMSG is specified immediately following the last declared command in the CL
program.
It will catch all the error escape messages that exist in the program and doesnt have
satisfying command level MONMSG or doesnt have any command level MONMSG.
MONITORING MESSAGES
MONMSG
MSGID ( )
CMPDTA ( ) EXEC ( )
MSGID-Required
CMPDTA (Optional)
EXEC - -(Optional)
CPF9830)
Now if we want to catch all the messages that start with CPF98.., then we can go for the below
MONMSG:
MONMSG
MSGID (CPF9800)
Now if we want to catch all the possible generic messages for CPF., we can use the below
MONMSG:
MONMSG
MSGID (CPF0000)
To have more generic message monitor, we can go for:
MONMSG
MSGID (CPF0000 MCH0000) EXEC (GOTO ERROR)
MONITORING MESSAGES
MONITORING MESSAGES
MONMSG / Difference between cpf0000 and cpf9999 in
as400
Before we go for the difference between CPF0000 and CPF9999, we need to understand how the
MONMSG works.
First, we can monitor for a specific message, e.g.
MONMSG
MSGID (CPF9821)
CPF9830)
Now if we want to catch all the messages that start with CPF98.., then we can go for the below
MONMSG:
MONMSG
MSGID (CPF9800)
Now if we want to catch all the possible generic messages for CPF., we can use the below
MONMSG:
MONMSG
MSGID (CPF0000)
But now suppose we have given the generic message handling MONMSG command as above, but
the program generates a message that is not in this generic list of messages then that will not be
handled.
That unhandled message is converted into CPF9999 by our system automatically.
FROM THE DESK OF N.K. ELURU
Page 4
MONITORING MESSAGES
Hence, all the unhandled messages are converted to CPF9999, which actually is being handled by
our generic MOMSG command.
Example
Suppose there is any program which needs parameter value (file name) to be passed, but actually we
are not passing the value in this case. In the program when we try to delete the file then what we
get an error CPD0071.
Hence, here this unhandled exception is converted to CPF9999 and then it is handled via
CPF0000(GENERIC MSG HANDLER).