      SUBROUTINE READLOCKFILE(icounter,maxprobe,
     * probelockrec,ip,lockstat,il,wholockrec,iw,
     * timerec,it,whatrec,iw2,iLOCK,ilockfile)

C     READLOCKFILE READS IN MERGELOCK FILE

      character*80 filename
      character*120 usrrec
      character*(*) probelockrec(maxprobe)
      character*(*) lockstat(maxprobe)
      character*(*) wholockrec(maxprobe)
      character*(*) timerec(maxprobe)
      character*(*) whatrec(maxprobe)
      dimension iLOCK(maxprobe)

      call clearstring(filename,80)
      call extraname('sys.inf'//CHAR(0),
     * 'mergeLOCK.log'//CHAR(0),filename)
      open(ilockfile,file=filename,status='old')

      icounter=0
      call clearstring(usrrec,120)

c     read header lines

      read(ilockfile,'(a)') usrrec
      read(ilockfile,'(a)') usrrec

c     read in probes 

      do 50 nn=1,maxprobe

       call clearstring(usrrec,120)
       iLOCK(nn)=0
       read(ilockfile,'(a)',END=2000) usrrec
       if ( usrrec(3:5) .eq. '   ' ) goto 2000
       icounter=icounter+1

       call readmergeline(usrrec,120,probelockrec(nn),ip,
     *  lockstat(nn),il,wholockrec(nn),iw,timerec(nn),it,
     *  whatrec(nn),iw2)
   
       iLOCK(nn)=0
       if ( lockstat(nn)(1:4) .eq. '*REA' ) iLOCK(nn)=1
       if ( lockstat(nn)(1:4) .eq. '*EXC' ) iLOCK(nn)=2
       if ( lockstat(nn)(1:4) .eq. 'OV_R' ) iLOCK(nn)=3
       if ( lockstat(nn)(1:4) .eq. 'OV_E' ) iLOCK(nn)=4

50    continue
2000  continue

      close(ilockfile,iostat=ios)

      return
      end 
