next up previous contents
Next: SNOMAN - Operating Instructions Up: Program Overview Previous: Termination   Contents

Error Recovery

In SNOMAN, as in most production software, the first level of structuring is to divide execution into 3 phases: INITIALISATION, OPERATION and TERMINATION.

The ZEBRA memory management package provides an error recovery system that recognises the different needs of these phases. In the current context an error is defined to be any situation which prevents normal execution and a classic example would be store full (a store full occurs when the event generates too many banks to fit in the memory allocated for ZEBRA) while trying to create a new bank. To use the STOP statement in such cases would be a very blunt instrument, particularly if it occurred after many events have been processed! However, the only alternative supported by FORTRAN is the RETURN statement with the called routine passing an error flag back to the caller. The calling routine may now find itself unable to proceed and have to repeat the process. So error recovery might involve stepping back through a number of calls each time setting and check error flags. Such recovery is both cumbersome and degrades program modularity which is why ZEBRA provides an alternative.

The error recovery supported by ZEBRA recognises 2 types of remedial action: to abandon the current event and proceed straight to the next one (the typical response to store full); and to abandon the run and move to the termination phase (the typical response for EOF on the input file). This service is provided by the routine ZTELL, with the caller signalling the type of recovery required. However ZEBRA recognises that starting the next event makes no sense in the context of the initialisation and termination phases so diverts such requests to the TERMINATION phase. ZEBRA is alert to the danger of this process looping if further calls to ZTELL are made during termination and aborts the program in this case.


next up previous contents
Next: SNOMAN - Operating Instructions Up: Program Overview Previous: Termination   Contents
sno Guest Acct 2009-09-09