next up previous contents
Next: Version numbering Up: Immediate Previous: Variable initialisation

Error Handling

All subroutines which can fail in any way must have STATUS included in its arguments. In general this will mean any routine which itself calls other routines which return STATUS. It also means any routine which could fail as a result of a previous bad status, for example a routine which accepts mapped data. In this case STATUS must be checked on entry to the routine and control returned immediately to the calling routine in order to prevent 'Access Violation' errors. If STATUS goes bad during the execution of a routine then this should be reported in order to provide a traceback to the offending routine. The following skeleton will in general take care of the above requirements.

      SUBROUTINE XXXX(STATUS)
                 .
                 .
      IF (STATUS.EQ.SAI__OK) THEN
                 .
                 .
                 .
        IF (STATUS.NE.SAI__OK) THEN
          CALL ERR_REP('XXXX','from XXXX',STATUS)
        ENDIF

      ENDIF
      END



Web Master
Wed Oct 8 09:22:15 BST 1997