      FUNCTION ISMAINPROBE(probename)

C     ISMAINPROBE CHECKS IF THE GIVEN PROBE IS A MAIN PROBE

      parameter (maxprobe=100)
      character*11 ctypemain(maxprobe),probename
      character*11 firsttime
      dimension nspm(maxprobe)

      save firsttime,ctypemain
      save nmain,nspm

      if ( firsttime .ne. 'ismainprobe' ) then
       call readmainprobes(ctypemain,maxprobe,nmain)
       do 45 nn=1,nmain
45      call findlastchar(nspm(nn),ctypemain(nn),11)
       firsttime='ismainprobe'
      endif

      ismainprobe=0
      call findlastchar(nsp,probename,11)

      do 50 n=1,nmain

       if ( nsp .eq. nspm(n) .and.
     *  probename(1:nsp) .eq. ctypemain(n)(1:nsp) )
     *  ismainprobe=1

50    continue

      return
      end
