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 r1
      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$qiow, sys$dassgn
      external sys$assign, sys$qiow, 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'
      tmo2 = -tmo * 10000000
      call sys$setimr(, tmo2, done, chan, )
      stat = sys$qiow(, %val(chan), %val(IO$_READVBLK),
     +                iosb, , ,
     +                buf, %val(1), , , , )
      if(stat.eq.SS$_NORMAL.and.iosb(1).eq.SS$_ABORT) 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))
      call sys$cantim(0, )
      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(chan)
      implicit none
      integer*2 chan
      call sys$cancel(%val(chan))
      return
      end
