At the level of applications code the Error Reporting System, ERR, exclusively should be used for
error reporting. Within environment subroutine libraries the rule is to use calls to EMS
unless it is necessary to deliver error messages to the user (i.e. by calls to ERR_FLUSH
). A
subroutine library must use one or other of these error reporting libraries exclusively: i.e. if
EMS calls are used within a subroutine library, they must be used exclusively throughout
the library – no calls to ERR routines are allowed. Furthermore, if ERR calls are used to
report errors within a subroutine library, say because calls to ERR_FLUSH
are required during
interaction with the user, then it must be understood that this subroutine library exists
at a hierarchical level above the environment system software. This subroutine library
cannot then be called from other libraries purporting to exist at lower levels within the
subroutine hierarchy – to do so could result in unpredictable behaviour when an error
occurs.
An exception to the above is when working with a threaded application. For these EMS should be used in the threaded portions and in general any error reporting via ERR should be deferred until the threaded sections complete. This avoids problems with global variable access in the ERR and ADAM libraries. See Appendix B.