[mod.computers.vax] FORTRAN READ timeout ...

charettep%v36b.DECnet@NUSC-WPN.ARPA.UUCP (07/30/86)

	Hi!  Does anyone out there know how to make FORTRAN duplicate the
action of a DCL READ/TIME_OUT?  I'd like to be able to prompt a user for a 
certain text string, but only allow him a certain amount of time to answer.  
I'm sure there must be some way, but I don't know how.  Any 
suggestions/solutions?  Advan*THANKS*ce!

          +--------------------------------------------------------+
          |                     Paul Charette                      |
          |            Naval Underwater Systems Centre             |
          |                      Newport, RI                       |
          |                                                        |
          |          ARPAmail: <charettep@nusc-wpn.ARPA>           |
          |   UUCPmail: {allegra!seismo}!nusc-wpn!charettep.UUCP   |
          +--------------------------------------------------------+
------

sci@KESTREL.ARPA.UUCP (07/31/86)

To get a FORTRAN READ with timout:

1) Get the channel of the TT:

	character*20	devnam
	CALL SYS$TRNLOG( 'TT',, devnam,, )
	CALL SYS$ASSIGN( devnam, ichan,, )

2) Issue a QIOW with timeout

	CALL SYS$QIOW( , %val(ichan), %val(IO$_READVBLK.or.IO$M_TIMED)
	1 ,,,, byinp, %val(80), %val(numsec),,, )

	where:

		INCLUDE '($IODEF)'  !! Includes the IO definitions
		byte	byinp(80)   !! Is the buffer to read to
		integer	numsec/10/  !! Is the number of seconds to wait

Note..
	To use this from a DCL program, you could get the prompt via

	CALL LIB$FOREIGN( chprompt,, num )
	TYPE *,chprompt(1:num)

	where:

		character*80 chprompt

	And then set a symbol to the returned value, or to a canned value

	CALL LIB$SET_SYMBOL( 'SCI_GETUSER', chreturn, 2 )

The DCL to get the timed read would then be:

	$ GETUSER = "$Disk:[Directory]GETUSER !! where GETUSER is the program
	$ GETUSER "$Please enter Response"
	$ if( SCI_GETUSER ... ) THEN	...	!! Test response