If your ILE RPG procedure is called by an ILE CL procedure in the same activation group, and the caller is monitoring for status or notify messages, then your ILE CL caller may get control prematurely because of a notify or status message that the ILE RPG procedure was trying to ignore.
For example, if the ILE RPG procedure writes a record to a printer file and the actual printer file has a shorter record length that was declared in the RPG procedure, notify message CPF4906 is sent to the RPG procedure. The RPG exception handling percolates this message which causes the default reply of 'I' to ignore the message. This should allow the output operation to continue normally, and the RPG procedure should proceed to the next instruction.
However, when the ILE CL MONMSG gets control, control passes immediately to the action for the MONMSG or the next statement in the ILE CL procedure.
This problem is most likely to occur with a MONMSG in an ILE CL caller, but it can also occur with other ILE languages that can monitor for notify and status messages, including ILE RPG using ILE condition handlers enabled using CEEHDLR.
If you encounter this problem, you have two possible ways to avoid it:
You could also make this handler more generic, and have it ignore all messages with a severity of 0 (information) and 1 (warning).
Figure 147 shows an example of a ILE condition handler that ignores CPF4906.
*----------------------------------------------------------------
* Handler definitions
*----------------------------------------------------------------
D Action S 10I 0
D Token DS
D MsgSev 5I 0
D MsgNo 2A
D 1A
D Prefix 3A
D 4A
*----------------------------------------------------------------
* Actions
*----------------------------------------------------------------
D Handle C 10
D Percolate C 20
*----------------------------------------------------------------
* Severities
*----------------------------------------------------------------
D Info C 0
D Warning C 1
D Error C 2
D Severe C 3
D Critical C 4
C *ENTRY PLIST
C PARM Token
C PARM dummy 1
C PARM Action
*----------------------------------------------------------------
* If this is CPF4906, handle the notify msg, otherwise percolate
*----------------------------------------------------------------
C IF Prefix = 'CPF' AND
C MsgNo = X'4906'
C EVAL Action = Handle
C ELSE
C EVAL Action = Percolate
C ENDIF
C RETURN
Figure 148 shows how you would code the calculations if you wanted to ignore all status and notify messages. Escape messages and function checks have a severity of 2 (Error) or higher.
*----------------------------------------------------------------
* Handle information or warning messages, otherwise percolate
*----------------------------------------------------------------
C IF MsgSev <= Warning
C EVAL Action = Handle
C ELSE
C EVAL Action = Percolate
C ENDIF
C RETURN