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

