The routine ZEND, which has no parameters, is defined to be the entry-point for normal run termination. It is normally provided by the user to close files and print accumulated results. It is important that all closing down operations are done through this routine, if the user wants them to happen even in abnormal run termination. It would normally look like this:
SUBROUTINE ZEND +CDE, ZSTATE. CALL ZPHASE (-3) start termination . . . any user termination code CALL MZEND IF (NQERR.NE.0) CALL ABEND STOP END
MZEND is a little routine which prints statistics about the usage of all divisions.
NQERR
in /ZSTATE/ is zero for normal run termination,
it is non-zero if ZEND has been reached via ZFATAL.
On some machines the recovery system of the machine
expects the user to re-enter it.
The KernLib routine ABEND (Z 035) looks after this.
The Zebra system contains a little default routine ZEND which is the above without any user termination.
A user routine similar to ZEND is defined for taking over control of fatal error termination. It is called ZABEND and it is described in the next paragraph. This should perform in there any extra operations needed for fatal termination and then it should transfer to ZEND for closing down.