On 6/21/2012 7:16 AM, Bernd Oppolzer wrote:
> You are right, the
> ON ERROR BEGIN;
> ON ERROR GOTO ENDE;
> unit works as expected.
> I tested it using a little test program which allocated buffer of 1 million bytes
> in a loop (1000 times). After the 400-th iteration the error unit was entered,
> following a STORAGE condition, which is reasonable, due to region size etc.
> The iterations continued as expected, but because there was no STORAGE,
> starting from then, the error unit was entered at every iteration.
> Now the difference to the real thing is:
> the storage is not allocated using PL/1-ALLOC, but the C++ math lib
> allocates the storage; maybe there is even Xerces or other software
> packages involved (some hundred modules, I don't know all of them).
> So I'm not sure if the short-on-storage condition below is reflected by
> a PL/1 STORAGE condition (maybe not). And: it could well be that
> there are additional error handlers below this PL/1 level (maybe
> C++ try/catch logic).
God knows what C and C++ do, they have only the most basic ideas of
error handling. What I would do if you want to keep the _idea_ of this
logic is have the first ERROR ON-unit execute "ON ERROR SYSTEM;" , try
its cleanup, reexecute the call _in the ON-Unit_, and then GOTO the
next statement following the original CALL, which should be changed to
"REVERT ERROR;". That way you only get one shot at recovery and
shouldn't be able to get an infinite loop.