      subroutine xioxyz(mode,iunit,x,nchan,ierr)
c
c  reads or writes a binary xyz record
c
c  mode:        'r' or 'w'
c  iunit:       fortran unit number
c  x:           real data array
c  nchan:       size of x array
c  ierr:        returns 0 if no error
c
      character mode*1
      dimension x(nchan)
c
      if(mode.eq.'r'.or.mode.eq.'R') then
        read(iunit,err=20,iostat=ierr) x
      else if(mode.eq.'w'.or.mode.eq.'W') then
        write(iunit,err=20,iostat=ierr) x
      else
        ierr=1
      endif
   20 return
      end


