c     XYZ2ROW.FOR
c     Converts ascii xyz file to 1-row grid.
c     Lin Cordell 12 August 92
c
      character*50 infile,outfile
      dimension f(2000),id(14),pgm(2)
      ifft=2
c  Input
      print*,' Enter input ascii xyz file name,'
      print 101, ' {x} assumed equi-spaced; output y0 and dy set to 1.'
101   format(a,/' *'$)
      read(5,100)infile
100   format(a50)
      print 101,' Enter dx:'
      read*,dx
      open(10,file=infile,form='formatted',status='old',err=995)
      read(10,*,end=21) x0,y0,f(1)
      n=2
20    read(10,*,end=21)x,y,f(n)
      n=n+1
      go to 20
21    ncol=n-1
      nrow=1
      y0=1.
      dy=1
      nz=1
      pgm(1)='xyz2'
      pgm(2)='row '
      print 101,' Enter output 1-row-grid file name:'
      read(5,100)outfile
      print 101,' Enter id:'
      read(5,102)(id(i),i=1,14)
102   format(14a4)
      open(11,file=outfile,status='new',form='unformatted')
      write(11)id,pgm,ncol,nrow,nz,x0,dx,y0,dy
      write(11) y0,(f(i),i=1,ncol)
      go to 999
995   print*,' Cant find the file.'
999   continue
      stop
      end
