ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

*** MONMSG *** for all possible errors

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • *** MONMSG *** for all possible errors

    Experts,
    I am issuing a MONMSG on a CL program right after I call a RPG program. I am using the generic messages CPF0000, MCH0000, RNQ0000, RNX0000.
    What are other generic error messages that I should look for?.
    Thanks




  • #2
    It can be questionable whether you should use CPF0000 or CPF9999 instead, especially if you're not responsible for coding the RPG program. CPF9999 is a "Function check" message that can be signalled for any unhandled *ESCAPE message. As such, it might catch MCH or other *ESCAPE messages as long as they haven't been otherwise handled. But CPF0000 is a generic message ID that catches any unhandled CPF message. Therefore it will also catch CPF9999.

    You might then think it doesn't make any difference which one is used, but there are a couple differences that can be important in particular circumstances.

    By the time CPF9999 is sent, the actual error that caused it has been somewhat "handled" by a default handler (resulting in the CPF9999). So CPF0000 catches CPF9999 rather than the actual error if the error is signalled as something other than a CPF message. If you want programming to do something with the actual error message, you then need to write code to pull it out of the queue. If the original error throws a CPF message, then CPF0000 catches it directly, and CPF9999 doesn't show up.

    But in addition to *ESCAPE messages, MONMSG also catches *STATUS and *NOTIFY messages. So MONMSG CPF0000 would get triggered if the RPG sends a CPF9898 *STATUS message, but MONMSG CPF9999 would ignore it. If *STATUS/*NOTIFY messages are used to signal to callers, you'll need to take some care with CPF0000. If some future developer needs to send such messages, surprises might be one result.

    In short, you might not need to worry about it at all, or unexpected oddities might show up someday.
    Tom

    There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

    Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

    Comment

    Working...
    X