xersve.f

Go to the documentation of this file.
00001 *DECK XERSVE
00002       SUBROUTINE XERSVE (LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL,
00003      +   ICOUNT)
00004 C***BEGIN PROLOGUE  XERSVE
00005 C***SUBSIDIARY
00006 C***PURPOSE  Record that an error has occurred.
00007 C***LIBRARY   SLATEC (XERROR)
00008 C***CATEGORY  R3
00009 C***TYPE      ALL (XERSVE-A)
00010 C***KEYWORDS  ERROR, XERROR
00011 C***AUTHOR  Jones, R. E., (SNLA)
00012 C***DESCRIPTION
00013 C
00014 C *Usage:
00015 C
00016 C        INTEGER  KFLAG, NERR, LEVEL, ICOUNT
00017 C        CHARACTER * (len) LIBRAR, SUBROU, MESSG
00018 C
00019 C        CALL XERSVE (LIBRAR, SUBROU, MESSG, KFLAG, NERR, LEVEL, ICOUNT)
00020 C
00021 C *Arguments:
00022 C
00023 C        LIBRAR :IN    is the library that the message is from.
00024 C        SUBROU :IN    is the subroutine that the message is from.
00025 C        MESSG  :IN    is the message to be saved.
00026 C        KFLAG  :IN    indicates the action to be performed.
00027 C                      when KFLAG > 0, the message in MESSG is saved.
00028 C                      when KFLAG=0 the tables will be dumped and
00029 C                      cleared.
00030 C                      when KFLAG < 0, the tables will be dumped and
00031 C                      not cleared.
00032 C        NERR   :IN    is the error number.
00033 C        LEVEL  :IN    is the error severity.
00034 C        ICOUNT :OUT   the number of times this message has been seen,
00035 C                      or zero if the table has overflowed and does not
00036 C                      contain this message specifically.  When KFLAG=0,
00037 C                      ICOUNT will not be altered.
00038 C
00039 C *Description:
00040 C
00041 C   Record that this error occurred and possibly dump and clear the
00042 C   tables.
00043 C
00044 C***REFERENCES  R. E. Jones and D. K. Kahaner, XERROR, the SLATEC
00045 C                 Error-handling Package, SAND82-0800, Sandia
00046 C                 Laboratories, 1982.
00047 C***ROUTINES CALLED  I1MACH, XGETUA
00048 C***REVISION HISTORY  (YYMMDD)
00049 C   800319  DATE WRITTEN
00050 C   861211  REVISION DATE from Version 3.2
00051 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00052 C   900413  Routine modified to remove reference to KFLAG.  (WRB)
00053 C   900510  Changed to add LIBRARY NAME and SUBROUTINE to calling
00054 C           sequence, use IF-THEN-ELSE, make number of saved entries
00055 C           easily changeable, changed routine name from XERSAV to
00056 C           XERSVE.  (RWC)
00057 C   910626  Added LIBTAB and SUBTAB to SAVE statement.  (BKS)
00058 C   920501  Reformatted the REFERENCES section.  (WRB)
00059 C***END PROLOGUE  XERSVE
00060       PARAMETER (LENTAB=10)
00061       INTEGER LUN(5)
00062       CHARACTER*(*) LIBRAR, SUBROU, MESSG
00063       CHARACTER*8  LIBTAB(LENTAB), SUBTAB(LENTAB), LIB, SUB
00064       CHARACTER*20 MESTAB(LENTAB), MES
00065       DIMENSION NERTAB(LENTAB), LEVTAB(LENTAB), KOUNT(LENTAB)
00066       SAVE LIBTAB, SUBTAB, MESTAB, NERTAB, LEVTAB, KOUNT, KOUNTX, NMSG
00067       DATA KOUNTX/0/, NMSG/0/
00068 C***FIRST EXECUTABLE STATEMENT  XERSVE
00069 C
00070       IF (KFLAG.LE.0) THEN
00071 C
00072 C        Dump the table.
00073 C
00074          IF (NMSG.EQ.0) RETURN
00075 C
00076 C        Print to each unit.
00077 C
00078          CALL XGETUA (LUN, NUNIT)
00079          DO 20 KUNIT = 1,NUNIT
00080             IUNIT = LUN(KUNIT)
00081             IF (IUNIT.EQ.0) IUNIT = I1MACH(4)
00082 C
00083 C           Print the table header.
00084 C
00085             WRITE (IUNIT,9000)
00086 C
00087 C           Print body of table.
00088 C
00089             DO 10 I = 1,NMSG
00090                WRITE (IUNIT,9010) LIBTAB(I), SUBTAB(I), MESTAB(I),
00091      *            NERTAB(I),LEVTAB(I),KOUNT(I)
00092    10       CONTINUE
00093 C
00094 C           Print number of other errors.
00095 C
00096             IF (KOUNTX.NE.0) WRITE (IUNIT,9020) KOUNTX
00097             WRITE (IUNIT,9030)
00098    20    CONTINUE
00099 C
00100 C        Clear the error tables.
00101 C
00102          IF (KFLAG.EQ.0) THEN
00103             NMSG = 0
00104             KOUNTX = 0
00105          ENDIF
00106       ELSE
00107 C
00108 C        PROCESS A MESSAGE...
00109 C        SEARCH FOR THIS MESSG, OR ELSE AN EMPTY SLOT FOR THIS MESSG,
00110 C        OR ELSE DETERMINE THAT THE ERROR TABLE IS FULL.
00111 C
00112          LIB = LIBRAR
00113          SUB = SUBROU
00114          MES = MESSG
00115          DO 30 I = 1,NMSG
00116             IF (LIB.EQ.LIBTAB(I) .AND. SUB.EQ.SUBTAB(I) .AND.
00117      *         MES.EQ.MESTAB(I) .AND. NERR.EQ.NERTAB(I) .AND.
00118      *         LEVEL.EQ.LEVTAB(I)) THEN
00119                   KOUNT(I) = KOUNT(I) + 1
00120                   ICOUNT = KOUNT(I)
00121                   RETURN
00122             ENDIF
00123    30    CONTINUE
00124 C
00125          IF (NMSG.LT.LENTAB) THEN
00126 C
00127 C           Empty slot found for new message.
00128 C
00129             NMSG = NMSG + 1
00130             LIBTAB(I) = LIB
00131             SUBTAB(I) = SUB
00132             MESTAB(I) = MES
00133             NERTAB(I) = NERR
00134             LEVTAB(I) = LEVEL
00135             KOUNT (I) = 1
00136             ICOUNT    = 1
00137          ELSE
00138 C
00139 C           Table is full.
00140 C
00141             KOUNTX = KOUNTX+1
00142             ICOUNT = 0
00143          ENDIF
00144       ENDIF
00145       RETURN
00146 C
00147 C     Formats.
00148 C
00149  9000 FORMAT ('0          ERROR MESSAGE SUMMARY' /
00150      +   ' LIBRARY    SUBROUTINE MESSAGE START             NERR',
00151      +   '     LEVEL     COUNT')
00152  9010 FORMAT (1X,A,3X,A,3X,A,3I10)
00153  9020 FORMAT ('0OTHER ERRORS NOT INDIVIDUALLY TABULATED = ', I10)
00154  9030 FORMAT (1X)
00155       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines