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 r
      implicit none
      include '($ssdef)'
      include '($iodef)'
      integer*1 buf(1)
      integer*2 chan, iosb(4)
      integer*4 stat, tmo
      integer*4 sys$assign, sys$qiow, sys$dassgn
      external sys$assign, sys$qiow, sys$dassgn
      stat = sys$assign('TT:', chan, , , )
      if(stat.ne.SS$_NORMAL) call ooops(stat)
      tmo = 10
      write(*,*) 'Press a key within ', tmo, ' seconds'
      stat = sys$qiow(, %val(chan), %val(IO$_READVBLK+IO$M_TIMED),
     +                iosb, , ,
     +                buf, %val(1), %val(tmo), , , )
      if(stat.eq.SS$_NORMAL.and.iosb(1).eq.SS$_TIMEOUT) then
        write(*,*) 'Arne you are too slow'
        goto 100
      end if
      if(stat.ne.SS$_NORMAL) call ooops(stat)
      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
