C   11/12/78 C9032101   MEMBER NAME  MESSAG   (JADEGS)      FORTRAN
      SUBROUTINE MESSAG(INDEX)
C
C     L.H.O'NEILL    XX-XX-XX   00:00
C     MODIFIED BY S.YAMADA  TO INCLUDE LEAD GLASS PART.  24-11-78
C
      IMPLICIT INTEGER*2 (H)
C-----------------------------------------------------------------------
C                            MACRO CGRAPH .... GRAPHICS COMMON
C-----------------------------------------------------------------------
C
      LOGICAL DSPDTL,SSTPS,PSTPS,FREEZE
C
      COMMON / CGRAPH / JUSCRN,NDDINN,NDDOUT,IDATSV(11),ICREC,MAXREC,
     +                  LSTCMD,ACMD,LASTVW,ISTANV,
     +                  SXIN,SXAX,SYIN,SYAX,XMIN,XMAX,YMIN,YMAX,
     +                  DSPDTL(30),SSTPS(10),PSTPS(10),FREEZE(30),
     +                  IREADM,LABEL,LSTPS(10),IPSVAR
C
C------- END OF MACRO CGRAPH -------------------------------------------
C
      COMMON /MESSGB/ MSGVAL(5)
      DIMENSION AMSGVL(5)
      EQUIVALENCE (MSGVAL(1),AMSGVL(1))
      DIMENSION KOUNT(20),LIMIT(20)
      DATA LIMIT/20*100/
      DATA KOUNT/20*0/
C
      IF((INDEX.LT.1).OR.(INDEX.GT.19)) GO TO 1001
      KOUNT(INDEX)=KOUNT(INDEX)+1
      IF(KOUNT(INDEX).GT.LIMIT(INDEX)) RETURN
C
      IF(INDEX.GT.10) GO TO 200
C
C---- SUPERVISER ERROR MSG.
      GO TO (1,2,3,4),INDEX
C
 1001 CONTINUE
      KOUNT(20)=KOUNT(20)+1
      IF(KOUNT(20).GT.LIMIT(20)) RETURN
      WRITE(JUSCRN,100)
  100 FORMAT(' MESSAG CALLED WITH ILLEGAL INDEX.')
      RETURN
C
    1 CONTINUE
      DATA NRDERR /0/
      NRDERR = NRDERR + 1
      IF(NRDERR.LE.20) WRITE(JUSCRN,101)
  101 FORMAT(' INPUT READ ERROR: CONTINUE')
      RETURN
C
    2 CONTINUE
      WRITE(JUSCRN,102)
  102 FORMAT(' ILLEGAL EVENT NUMBER REQUESTED.')
      RETURN
    3 CONTINUE
      WRITE(JUSCRN,103)
  103 FORMAT(' ILLEGAL USER INDEX. SKIP REST OF INPUT DS AND END.')
      RETURN
    4 CONTINUE
      WRITE(JUSCRN,104)
  104 FORMAT(' HEADER BANK MISSING IN INPUT EVENT. SKIP EVENT.')
      RETURN
C
C---- LEAD GLASS ERROR MSG.
  200 LGINDX = INDEX-10
      GO TO (201,202,203,204,205,206,207),LGINDX
  201 WRITE(JUSCRN,6201)
 6201 FORMAT('0***** BUFFER OVER FLOW IN LGADCN *****')
      RETURN
  202 WRITE(JUSCRN,6202) MSGVAL
 6202 FORMAT(' ***** LG-DATA ILLEGAL ADDRESS:',I5)
      RETURN
  203 WRITE(JUSCRN,6203)
 6203 FORMAT(' ******* TOO MANY LG-CLUSTERS *******')
  204 RETURN
  205 WRITE(JUSCRN,6205) MSGVAL(1),AMSGVL(2),AMSGVL(3)
 6205 FORMAT(' NON-CONVERGENCE FOR DEPAV IN (LGAVRZ). NTRY,DEPO,DEP=',
     1       I3,2F10.2,'  **********')
      RETURN
  206 WRITE(JUSCRN,6206) MSGVAL(1)
 6206 FORMAT(' ** ERROR IN /LGCL/ COPY.IER FROM JBCRA=',I5,' *****')
      RETURN
  207 WRITE(JUSCRN,6207) MSGVAL(1)
 6207 FORMAT(' ** ERROR IN /ALGN/ COPY.IER FROM JBCRA=',I5,' *****')
      RETURN
      END
