C   14/09/79 911131438  MEMBER NAME  TRELTR   (JADEGS)      FORTRAN
      SUBROUTINE TRELTR(ITREL,MTR,MTR2)
      IMPLICIT INTEGER*2 (H)
C---
C---     FIND WHICH TRACKS MTR,MTR2 ARE ASSOCIATED TO TRACK ELEM. ITREL
C---
C----------------------------------------------
C  MACRO CWORKPR .... PATTERN RECOGNITION CWORK
C----------------------------------------------
      COMMON /CWORK/ HPLAST,HPFREE,HPWRK(30),ADWRK(600),
     ,               HPRO,HNTR,HNTCEL(98),IPCL(200),NRHT(200),
     ,               NWR1(200),DS1(200),SL1(200),
     ,               NWR2(200),DS2(200),SL2(200),
     ,               LBL(200),NTREL(200),ICRO(200),
     ,               NTR,HNREL(100),HISTR(9,100),HRES(168),
     ,               NTRLM,RLMTR(3,5),
     ,               WRK(7000)
                     DIMENSION TRKAR(200,11),ITRKAR(200,11),
     ,                         LMRTR(3,5)
                     EQUIVALENCE (IPCL(1),TRKAR(1,1),ITRKAR(1,1))
                     EQUIVALENCE (LMRTR(1,1),RLMTR(1,1))
         DIMENSION IWRK(7000),HWRK(14000),IDWRK(600),HDWRK(1200)
                     EQUIVALENCE (IWRK(1),WRK(1),HWRK(1))
                     EQUIVALENCE (IDWRK(1),ADWRK(1),HDWRK(1))
C---------- END OF MACRO CWORKPR --------------
      DIMENSION MTRR(2)
C
      MTRR(1) = 0
      MTRR(2) = 0
      IF(ITREL.LT.0.OR.ITREL.GT.HNTR) GO TO 1001
      IAMB = 0
      IF(NTR.LE.0) GO TO 1002
      DO 2  ITR = 1,NTR
      KNREL = HNREL(ITR)
      IF(KNREL.LE.0.OR.KNREL.GT.9) GO TO 1003
      DO 2  INREL = 1,KNREL
      JNREL = HISTR(INREL,ITR)
      IF(ITREL.NE.IABS(JNREL)) GO TO 2
      IAMB = IAMB + 1
      IF(IAMB.GT.2) GO TO 1004
      MTRR(IAMB) = ITR*ISIGN(1,JNREL)
2     CONTINUE
2001  MTR = MTRR(1)
      MTR2 = MTRR(2)
      GO TO 2000
C * * *  ERROR MESSAGES
1001  WRITE(6,1101) ITREL
1101  FORMAT(' ERROR IN TRELTR:  ITREL = ',I10)
      GO TO 2001
1002  WRITE(6,1102) NTR
1102  FORMAT(' ERROR IN TRELTR:  NTR = ',I10)
      GO TO 2001
1003  WRITE(6,1103) KNREL
1103  FORMAT(' ERROR IN TRELTR:  KNREL = ',I10)
      GO TO 2001
C1004  WRITE(6,1104)
1104  FORMAT(' ERROR IN TRELTR:  MORE THAN TWO TRACKS ASSOCIATED WITH A
     $ TRACK ELEMENT')
1004  GO TO 2001
2000  RETURN
      END
