C   06/02/79 002210700  MEMBER NAME  TPMESG   (SOURCE)      FORTRAN
      SUBROUTINE TPMESG(INDEX)
C
C     S.YAMADA      22-02-79  23:00
C     LAST MODIFICATION   22-08-79  10:55  E.ELSEN
C
C---- TP MESSAGES
C
      IMPLICIT INTEGER *2 (H)
#include "cdata.for"
C
      COMMON /CTPFLG/ ITPFLG(15),ISTEP
      COMMON /CTPMCT/ ICREC,MAXREC, NRUN,NRUN1,NRUN2,KRUN1,KRUN2,
     $                NTLEFT,NTOUT
      INTEGER *2 LIMIT(20)/20*10/
      INTEGER *2 KOUNT(20)/20*0/
C
      IF(INDEX.LT.1) RETURN
      IF(INDEX.GT.20) GO TO 200
C
      KOUNT(INDEX)=KOUNT(INDEX)+1
      IF(KOUNT(INDEX).GT.LIMIT(INDEX)) RETURN
C
C
      IF( INDEX.GT.10 ) GO TO 100
      GO TO (1,2,3,4,5,6,7,8,9,10),INDEX
C
    1 WRITE(6,601)
  601 FORMAT(' (TPMAIN) INPUT READ ERROR. PROGRAMMED STOP.')
      STOP
C
    2 WRITE(6,602)
  602 FORMAT(' (TPMAIN) EVENT HEADER IS MISSING.')
      RETURN
C
    3 WRITE(6,603) ISTEP
  603 FORMAT(' (TPSPRV) /BCS/ SPACE IS NOT ENOUGH TO PUT A NEW BANK.',
     $       '  ISTEP=',I3)
      RETURN
C
    4 WRITE(6,604)
  604 FORMAT(' (TPVTX1)  VERTEX CALCULATION DOES NOT CONVERGE.')
      RETURN
C
    5 WRITE(6,605)
  605 FORMAT(' (TPTOF) WRONG INNER TRACK INDEX')
      RETURN
C
    6 WRITE(6,606)
  606 FORMAT(' (TPTOF) ''TOFR''-BANK IS MISSING')
      RETURN
C
    7 RETURN
C
    8 WRITE(6,608)
  608 FORMAT(' (TPLGCL) ''TPVX''-1 IS MISSING')
      RETURN
C
    9 RETURN
C
   10 RETURN
C
C
  100 INDEX1 = INDEX-10
      GO TO (11,12,13,14,15,16,17,18,19,20),INDEX1
   11 RETURN
C
   12 RETURN
C
   13 RETURN
C
   14 RETURN
C
   15 RETURN
C
   16 WRITE(6,616)
  616 FORMAT(' (TPTCNT), TPVX-I IS MISSING.')
      RETURN
C
   17 WRITE(6,617)
  617 FORMAT(' (TPGNRL) ''TPVX'' IS MISSING OR ''TPTR''/NIS MISSING.')
      RETURN
C
   18 WRITE(6,618)
  618 FORMAT(' (TPGNRL)  ''TPTR''-N IS MISSING ALTHOUGH IT IS SPECIFIED
     & BY THE ''TPVX'' TRACK LIST')
      RETURN
C
   19 WRITE(6,619)
  619 FORMAT(' (TPGNRL)   MOMENTUM BUFFER OVERFLOW')
      RETURN
C
   20 WRITE(6,620)
  620 FORMAT(' (TPBNKS)   ERROR IN BCHM')
      RETURN
C
C
C---- TP-JOB FINISHING MESAGES
C
  200 INDEX1 = INDEX-20
      GO TO (21,22,23,24),INDEX1
   21 WRITE(6,621)
  621 FORMAT('0<< DATA END >>')
      GO TO 25
   22 WRITE(6,622)
  622 FORMAT('0<< NRUN EXCEEDED NRUN2 >>')
      GO TO 25
   23 WRITE(6,623)
  623 FORMAT('0<< ICREC EXCEEDED MAXREC >>')
      GO TO 25
   24 WRITE(6,624)
  624 FORMAT('0<< TIME OUT >>')
   25 WRITE(6,625)  ICREC, NTLEFT,KRUN1,KRUN2
  625 FORMAT(' IREC=',I5,5X,'LEFT TIME=',I7,5X,'1-ST RUN=',I10,
     $         5X,'LAST RUN=',I10)
C
C---- DUMP THE EVENT NO. WHICH IS LEFT IN THE BFFER
C     CALL CLOC( NPHD,'HEAD',0)
      IF(INITP.GT.0) GO TO 30
      INITP=1
      IPHD= IBLN('HEAD')
30    CONTINUE
      NPHD=IDATA(IPHD)
      IF(NPHD.LE.0) RETURN
      N1 = NPHD+NPHD+9
      N2 = N1+2
      WRITE(6,626) (HDATA(NN),NN=N1,N2)
  626 FORMAT(' THE EVENT LEFT IN THE BUFFER, IEXP,IRUN,IREC=',3I6)
      RETURN
      END
