      SUBROUTINE MAKEMERGELINE(cline,probelockrec,ip,
     * lockstat,il,wholockrec,iw,timerec,it,whatrec,iw2)

C     READMERGELINE READS IN A LINE FROM
C     THE MERGELOCK FILE AND PLACES THE
C     INFORMATION IN THE APPROPRIATE FIELDS

      parameter (icmax=10,maxform=38)
      character*38 cform
      character*(*) probelockrec
      character*(*) cline
      character*(*) lockstat
      character*(*) wholockrec
      character*(*) timerec
      character*(*) whatrec

      cform="(2x,aAA,BBx,aCC,DDx,aEE,1x,aFF,1x,aGG)"

c     Center lock status

      call centerchar(lockstat,il,ileftspace,icenter,
     * irightspace)
      call insertnum('A',ip,cform,maxform)
      call insertnum('B',ileftspace,cform,maxform)
      call insertnum('C',icenter,cform,maxform)
      call insertnum('D',irightspace,cform,maxform)
      call insertnum('E',iw,cform,maxform)
      call insertnum('F',it,cform,maxform)
      call insertnum('G',iw2,cform,maxform)

      write(cline,cform) probelockrec,lockstat(1:icenter),
     * wholockrec,timerec,whatrec

      return
      end

      SUBROUTINE CENTERCHAR(char,nchar,ileftspace,icenter,
     * irightspace)

C     CENTERCHAR CALCULATES LEFT-SPACE, RIGHT-SPACE AND
C     NUMBER OF CHARACTERS IN CENTER TO CENTER A CHARACTER
C     STRING IN A GIVEN SPACE

      character*(*) char
      call findlastchar(icenter,char,nchar)
      if ( icenter .eq. 0 ) then
       icenter=1
       char(1:1)='-'
      endif

      irightspace=(nchar-icenter)/2 
      ileftspace=irightspace
      if ( icenter + ileftspace + irightspace .lt. nchar ) 
     * ileftspace=ileftspace+1

      return
      end
