      subroutine cbsu3rw_meas(irpt,iud,iudr,irw) ! Bernd Berg Dec 6 2008.
C Read/Write of time series measurements.
C irw=1 write only. irw=2 read and write. irw=3 read only.
C read:   file already open and stays open.
C write:  (open->rewind->write->close for safety) data.
      include '../../Libs/Fortran/implicit.sta'
      include '../../Libs/Fortran/constants.par'
      include '../../Libs/Fortran_par/latmpi.par'
      include '../../Libs/Fortran_par/mc.par'
      include '../../Libs/MPI_par/common_cblat.f'
      include '../../Libs/MPISU3/common_cbsu3.f'
      ltest=.true.
      ltest=.false.
      if(ltest) stop "cbsu3rw_meas: ltest."
c
c Read unit already open. Why?
      if(irw.ge.2) then
        read(iudr) tsa,UPDATE,acpt,irpt 
      STOP "cbsu3rw_meas needs UPDATE."
      endif
c
      if(irw.le.2) then ! Write measurements
        open(unit=iud,file=cfln//cfile//".D",form="unformatted",
     &       status="old",access="append")
        write(iud) tsa,tsws,tswt,tspr,tspi,tsk1r,tsk1i,
     &             acpt,a_min,a_max,irpt
        close(iud)
      endif
      return
      end
