On 2/2/2011 12:09 PM, David FOXWELL wrote:
Barbara, I was getting :
(C G D F) Call to mylinearmain ended in error.
When I display the job, I see that I'm in a subprocedure of my linear
main program. Adding a break point to the caller, which is an rpg
program without the main keyword, I see that answering 'G' takes me
back to the caller. There seems to be some conflicting information :
the message says the program ended and the DSPJOB shows it has not.
So if I had a pile of callers, all linear main, with a CLP at the
origin, then pressing G would take me all the way back to that CLP?
David, you're right that the programs and procedures called by your
first calling program haven't actually ended yet. At the point when the
inquiry message is being shown the program stack is sort of suspended
while the system is waiting for an exception handler to do something
with the exception. While RPG's default exception handler never handles
the exception so that the procedure getting the actual exception (your
subprocedure) could continue, it's possible to do that, so everything is
still sitting on the stack waiting.
When you answer 'G' to the RPG inquiry message, the RPG default handler
branches to the *GETIN location in your calling program.
If you answered 'C', the RPG default handler would percolate the
exception so the system would keep the program stack in suspension until
a control boundary was reached. At that point it would finally take the
procedures off the stack.
Try this. Call the program, and when you get an inquiry message for
INQ2, look at the program stack from another job. Then respond with C
and the look at the program stack again when you get the second inquiry
message for INQ1.
INQ1:
H dftactgrp(*no) actgrp('AG1')
C call 'INQ2'
C eval *inlr = '1'
INQ2:
H dftactgrp(*no) actgrp('AG1')
C call 'INQ3'
C eval *inlr = '1'
INQ3:
H dftactgrp(*no) actgrp('AG1')
h main(inq3)
D inq3 pr extpgm('INQ3')
D sub pr
P inq3 b
C callp sub
P inq3 e
P sub b
D zero s 10i 0
C div zero zero
P sub e
My stack during the first inquiry message for the failed call from INQ2
to INQ3:
INQ1 BMORRIS _QRNP_PEP_INQ1
INQ1 BMORRIS 1 INQ1
INQ2 BMORRIS _QRNP_PEP_INQ2
INQ2 BMORRIS 1 INQ2
INQ3 BMORRIS _QRNP_PEP_INQ3
INQ3 BMORRIS 5 INQ3
INQ3 BMORRIS 9 SUB
During the second inquiry message for the failed call from INQ1 to INQ2:
INQ1 BMORRIS _QRNP_PEP_INQ1
INQ1 BMORRIS 1 INQ1
INQ2 BMORRIS _QRNP_PEP_INQ2
So after the first inquiry message, program INQ3 was indeed ended. But
during the second inquiry message program INQ2 is still suspended
pending the completion of exception handling in INQ1 for the failed call
to INQ2.
As an Amazon Associate we earn from qualifying purchases.