A command-level message monitor lets you monitor for specific messages that might occur during the execution of a single command.
A program-level message monitor is a MONMSG command like CPF0000 that will trap all errors in the pgm and then the user can be informed that an error has taken place using SNDPGMMSG.
The command-level MONMSG commands take precedence over the procedure-level MONMSG commands.
A program-level MONMSG is placed after the declarative statements and <i>before</i> the executable statements in the program. It applies to every executable statement in the rest of the program. The most common usage is to monitor for all exceptions that are not explicitly monitored on individual statements later. You can have multiple program-level monitors, each monitoring for different types of exceptions.
A program-level monitor can only execute a GOTO command when an exception occurs. Different program-level monitors can GOTO different labels in the program or to the same labels.
Usually a program-level monitor will watch for a generic message identifier such as CPF0000 and MCH0000 in order to catch all exceptions of those types.
A command-level MONMSG only applies to the single executable statements that it follows. Multiple command-level monitors can be placed after each executable statement.
A command level monitor can execute any other executable statement. Often, the executable statement will be a DO statement in order to run a block of statements in a DO/ENDDO group. A GOTO statement is not required.
In short, a program-level monitor applies to all statements in the program. A command-level monitor only catches messages from the single statement that it follows.
A command-level monitor will only see the messages that can be sent from the command that it follows. A program-level monitor can see all of the messages that can be sent from any statement in the program (unless a command-level monitor catches it first).