On 21-Oct-2015 11:37 -0500, Vicki Wilson wrote:
Instead of saying the program works differently in OPM vs ILE. I
probably should say the behavior is different when called from a
cycle-main or linear-main.
A feature of the linear-main is ridding of the cycle and all the code
generated along with making the cycle functional. One of those features
of the cycle that is removed by using linear-main isntead, is the
generation by the compile of exception monitoring and the implicit
handling [for those monitors] being code-generated to invoke the
Run-Time Default Handler. The run-time default handler is the feature
that is responsible for sending up the RNQxxxx inquiry message saying,
"Help! Your program has fallen, and needs help getting up."
For lack of these built-in monitors\handlers, the onus is on the
programmer to include their own monitors and\or cancel-handlers for
unexpected errors or terminations.
The service program uses QMHSNDPM to send a CPF9898 Escape message.
The procedure\program receiving an escape must have a monitor active
to avoid an unmonitored exception and the so-called /Function Check/, a
[not very clear] term to mean that the program failed miserable, for
lack of being prepared for the situation with which the program was
presented.
In all the old cycle main programs this works as expected. The
program hard-halts with an inquiry message.
Terminology is probably an issue here.
An inquiry is probably better described as a soft-halt, whereby an
opportunity is given to investigate the problem before the program
thoroughly crashes and burns by leaving the stack; i.e. the program is
stopped in a way that allows review and even to activate debug to more
easily review actual variables, and notably, some default handlers may
even offer a R=Retry which should further /soften/ the effect.?
What hard-halt in the more common vernacular means, is that the
program encounters the exception, the program leaves the stack, and the
only review is in-hindsight; i.e. there is no opportunity to review the
environment, the variables, really nothing but any logging.
However some of us in the shop are starting to write linear-main
programs. And when QMHSNDPM is issued we do not get the inquiry
message.
As describe earlier, the programmer must code a cancel handler and\or
montior(s).
I've been spending a lot of time reading the manuals and my
conclusion was that the cycle main programs are handling the errors
like OPM.
[http://www.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzasc/sc092507329.htm%23opmdiff]
Not handled /like OPM/, but handled like the Cycle code has been
generated into the created program; i.e. irrespective the program-model.
Going back to the previous page in the above doc reference; paying
especially close attention at occurrences "cycle" and "linear":
[
http://www-01.ibm.com/support/knowledgecenter/ssw_ibm_i_71/rzasc/sc092507328.htm%23hexsub]
_Exception Handling within Subprocedures_
"Exception handling within a subprocedure, including one designated as a
linear-main procedure, differs from exception handling within a
cycle-main procedure in the following ways:
• If you are using a global file, then because you cannot code an
INFSR subroutine for that file, you should handle file errors using
error indicators, the 'E' operation code extender, or a MONITOR group.
• There is no default handler; in other words, users will never see
an inquiry message.
Exception handling within a subprocedure differs from a cycle-main
procedure primarily because there is no RPG cycle code generated for
subprocedures. As a result there is no default exception handler for
subprocedures and so situations where the default handler would be
called for a cycle-main procedure correspond to abnormal end of the
subprocedure. This means that:
..."
I asked about determining OPM vs ILE because I was assuming if I
knew the environment I could either issue the QMHSNDPM differently.
Another terminology issue is being able to intuit the intention for
the use of "OPM vs ILE"; does one mean the /characteristics of OPM/ or
the actual /non-ILE/ when referring to the acronym\term OPM?
There is indeed a difference between the sending of a message to the
literal OPM Program (*PGM) object vs sending to the ILE Program for
which essentially the message is being sent instead to a procedure.
The original service program is a program that checks SQL state. As
we moved to more embedded SQL folks were getting burned because they
weren't always checking the state.
The service program checks the state and issues the QMHSNDPM when the
sqlstate is an error.
It was inspired from:
[https://www.ibm.com/developerworks/community/forums/html/topic?id=d2c49b79-5a01-46f7-9a11-b9de0f2b0e02#3b47a829-e864-44db-99c4-653a7547add2]
[http://www.ibmsystemsmag.com/ibmi/developer/rpg/unexpected_errors/]
This whole exercise leaves me with a lot of questions. My guess is an
awful lot of folks out there rely on hard-halts or crashes even
though the code is running in "ILE."
I did not refresh myself on that discussion about the sqlstate nor
the concepts of the generic sql-state handler [nor review the other
article]. But I think the prior information in my reply might help...
such that perhaps not even returning to that other discussion will be
necessary; i.e. remain as just background info.
As an Amazon Associate we earn from qualifying purchases.