If an error is detected during execution of a PL/I program, and no ON-unit is provided in the program to terminate execution or attempt recovery, the job terminates abnormally. However, you can record the status of your program at the point where the error occurred by using an ERROR ON-unit that contains the statements:
on error
begin;
on error system;
call plidump ('TFBS','This is a dump');
end;
The statement ON ERROR SYSTEM; contained in the ON-unit ensures that further errors caused by attempting to transmit uninitialized variables do not result in an endless loop.
If you want to take action based on the specific type of condition being handled, use the ONCONDID function (for more information on this function, see the PL/I Language Reference):
on anycondition
begin;
on anycondition system;
select( oncondid() );
when( condid_ofl )
.
.
.
when( condid_ufl )
.
.
.
when( condid_zdiv )
.
.
.
otherwise
resignal;
end;
end;