On 2020-03-06 4:01 a.m., Bruno VARON wrote:
Hello Peter,
I send CPF9897 message of QCPFMSG, MONMSG keep the message.
but the caller RPG program receive the message too.
I think it is due to the "Program Return Code" of the job. You can see
this value in DSPJOB OPTION(*STSA).
When the main procedure of the ILE RPG module ROXBMXR ends abnormally
after sending the escape message, ILE RPG sets the return code to '2'.
This is done as part of the RPG cycle, so I guess that your ILE RPG
module is not a NOMAIN module.
OPM RPG checks this return code after a call, and if the return code is
still '2', OPM RPG thinks that the call failed.
ILE RPG does not check the return code after a call unless the call
failed some other way.
This is actually mentioned in the ILE RPG Programmer's Guide in the
section about difference between ILE RPG and OPM RPG:
https://www.ibm.com/support/knowledgecenter/ssw_ibm_i_74/rzasc/diffrun.htm
"5. ILE RPG does not interpret return codes that are not 0 or 1 for
calls to programs or procedures that end without an exception."
To stop the OPM RPG program from ending in error, you could add an error
indicator to the CALL.
Or, you could change the ILE RPG module ROXMBXR so that it is a NOMAIN
module, where the code is in a subprocedure called ROXMBXR. When a
subprocedure ends abnormally, ILE RPG does not set the 'Program Return
Code' to '2'.
As an Amazon Associate we earn from qualifying purchases.