      integer function MATCH(NUMB,NUMNAM,LENS,NAME,MINS)
      integer K, NUMB, NUMNAM, NOCHAR, LENS(NUMB), LSTART, MINS(NUMB)
      integer LENGTH, I, MNLEN, J, LOOP
      character NAME(NUMNAM)*1, TEMP1*1, TEMP2*1, LOWER*26, UPPER*26
      include 'INPAR.INC'
      data LOWER /'abcdefghijklmnopqrstuvwxyz'/
      data UPPER /'ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
      LENGTH = STOPIT-START
      K = 0
      do 150 I = 1, NUMB
         NOCHAR = LENS(I)
         if (I.ne.1) K = K+LENS(I-1)
         if (LENGTH.gt.NOCHAR) go to 150
         MNLEN = MINS(I)
         if (LENGTH.lt.MNLEN) go to 150
         LSTART = START-1
         do 110 J = 1, MNLEN
            LSTART = LSTART+1
            TEMP1 = INPUT(LSTART:LSTART)
            TEMP2 = NAME(J+K)
            if (TEMP1.eq.TEMP2) go to 110
            do 100 LOOP = 1, 26
               if (TEMP1.ne.LOWER(LOOP:LOOP)) go to 100
               if (UPPER(LOOP:LOOP).eq.TEMP2) go to 110
               go to 150
100         continue
            go to 150
110      continue
         if (MNLEN.eq.LENGTH) go to 140
         MNLEN = MNLEN+1
         do 130 J = MNLEN, LENGTH
            LSTART = LSTART+1
            TEMP1 = INPUT(LSTART:LSTART)
            TEMP2 = NAME(J+K)
            if (TEMP1.eq.TEMP2) go to 130
            do 120 LOOP = 1, 26
               if (TEMP1.ne.LOWER(LOOP:LOOP)) go to 120
               if (UPPER(LOOP:LOOP).eq.TEMP2) go to 130
               go to 150
120         continue
            go to 150
130      continue
140      continue
         MATCH = I
         go to 160
150   continue
      MATCH = 0
160   continue
      return
      end
