*23456789a123456789b123456789c123456789d123456789e123456789f123456789g12
*
      program lc
      parameter (nrecord=80,nmag=6)
      dimension col(0:nmag)
      character blank*80,record*80,
     & filenm(nmag)*20,fmt1*6,fmt2*6
      data filenm/'./lc_brunob.dat','./lc_brunov.dat',
     & './lc_brunou.dat','./lc_brunoh.dat',
     &            './lc_brunoj.dat','./lc_brunok.dat'/
*
      do 402 i=1,nrecord
      blank(i:i)=' '
  402 continue
*
      imaga=1
      imagb=3
      dayzero=-18.0
      write(fmt1,'(a2,i3,a1)') '(a',nrecord,')'
*      print*,fmt1
*
      open(unit=10,file='./lc_bruno2.dat',status='old')
      do 410 i=imaga,imagb
      open(unit=i,file=filenm(i),status='unknown')
  410 continue
*
  110 continue
*      print*,'Before first read'
      read(10,fmt1) record
*      print*,'After first read'
      irecord=lentrue(record)
*      print*,irecord
      write(fmt2,'(a2,i3,a1)') '(a',irecord,')'
      do 420 i=imaga,imagb
      write(i,fmt2) record(1:irecord)
  420 continue
      if(record(1:3) .ne. 'END') go to 110
*
  120 continue
      record=blank
      read(10,fmt1,end=140) record
      irecord=lentrue(record)
      icol=0
      itell=0
      do 430 i=1,irecord+1
      if(record(i:i) .ne. ' '  .and.  itell .eq. 0) then
          itell=1
          istart=i
        else if(record(i:i) .eq. ' '  .and.  itell .eq. 1) then
          if(record(istart:istart+1) .eq. '..') then
              col(icol)=-100.
            else
              read(record(istart:i-1),*) col(icol)
          end if
          if(icol .eq. imagb) go to 130
          icol=icol+1
          itell=0
      end if
  430 continue
  130 continue
*
      do 440 i=imaga,imagb
      if(col(i) .gt. -99.)
     & write(i,'(f10.2,f10.4)') col(0)-dayzero,col(i)
  440 continue
      go to 120
*
  140 continue
*
      close(unit=10)
      do 450 i=imaga,imagb
      close(unit=i)
  450 continue
*
      end
*
*
*
*
      FUNCTION LENTRUE(STRING)
      CHARACTER*(*) STRING
*
      DO 410 I=LEN(STRING),1,-1
      IF(STRING(I:I) .NE. ' '
     1     .AND.  ICHAR(STRING(I:I)) .NE. 0) THEN
          LENTRUE=I
          GO TO 110
      END IF
  410 CONTINUE
      LENTRUE=0
  110 CONTINUE
*
      RETURN
      END
