C Collection of code snippets by Arne Vajhøj 
C (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
      program r2
      implicit none
      include '($ssdef)'
      include '($iodef)'
      integer*1 buf(1)
      integer*2 chan, iosb(4)
      integer*4 stat, tmo
      integer*8 tmo2
      integer*4 sys$assign, sys$qio, sys$dassgn
      external sys$assign, sys$qio, sys$dassgn
      external done
      stat = sys$assign('TT:', chan, , , )
      if(stat.ne.SS$_NORMAL) call ooops(stat)
      tmo = 10
      write(*,*) 'Press a key within ', tmo, ' seconds'
      stat = sys$qio(, %val(chan), %val(IO$_READVBLK),
     +               iosb, done, ,
     +               buf, %val(1), , , , )
      if(stat.ne.SS$_NORMAL) call ooops(stat)
      tmo2 = -tmo * 10000000
      call sys$schdwk(, , tmo2, )
      call sys$hiber()
      if(iosb(1).eq.0) then
        write(*,*) 'Arne you are too slow'
        goto 100
      end if
      if(iosb(1).ne.SS$_NORMAL) call ooops(iosb(1))
      write(*,*) 'You entered code: ', buf
100   stat = sys$dassgn(%val(chan))
      if(stat.ne.SS$_NORMAL) call ooops(stat)
      end
c
      subroutine ooops(stat)
      implicit none
      integer*4 stat
      write(*,*) 'status = ', stat
      stop
      end
c
      subroutine done
      implicit none
      call sys$wake(, )
      return
      end
