Exceptions/Catch an exception thrown in a nested call: Difference between revisions

Line 735:
 
=={{header|PL/I}}==
{{incomplete|PL/I|It fails to show/describe what happens when the program is run.}}
<lang PL/I>
/* Exceptions: Catch an exception thrown in a nested call */
Line 767 ⟶ 766:
m = foo();
end test;
 
 
DESCRIPTION OF EXECUTION:
 
Function FOO is invoked.
FOO invokes BAR. BAR invoked BAZ.
In BAZ, exception UO is raised, and is handled in FOO,
which outputs a message and a traceback is produced.
Upon return to BAZ, BAZ terminates, and control returns to FOO.
In FOO, BAR is invoked a second time, which in turn invokes BAZ.
This (second) time that BAZ is invoked, the exception U1 is raised.
As this exception is defined in the outer procedure TEST,
a diagnostic and traceback are produced, and execution resumes
in BAZ, returns to BAR, and then to FOO.
Finally, a return is made to TEST and the program terminates.
 
 
OUTPUT:
 
CONDITION condition was raised
At offset +000000E0 in procedure with entry FOO
From offset +0000007C in procedure with entry TEST
 
Raised condition U0 in function <bar>.
IBM0400I ONCODE=0500 The CONDITION condition was raised
by a SIGNAL statement and the condition U1 was signaled.
At offset +0000010D in procedure with entry FOO
</lang>
 
Anonymous user