If an error is detected during run time and no ON-unit is provided
in the routine to terminate the run or attempt recovery, the job terminates
abnormally. However, the status of a routine at the point where the
error occurred can be recorded by using an ERROR ON-unit that contains
the statements. In the following example, the statement
ON
ERROR SYSTEM ensures that further errors do not result in
a permanent loop.
ON ERROR
BEGIN;
ON ERROR SYSTEM;
CALL PLIDUMP; /*generates a dump*/
PUT DATA; /*displays variables*/
END;