This function provides time delay services to your REXX application. It does not read or write to any I/O. REXX provides time delay in one second increments only with the function SysSleep in REXXUTIL.DLL. The RTDelay function provides time delay in the range of 1 to 1000 milliseconds and is useful if some I/O hardware needs this short delay for proper operation. Note: This time delay is rounded up to the next system clock tick and is therefore not accurate to the millisecond. The format of the function is:
return_data = RTDelay( delay_value )
The delay_value is in the range of 1 to 1000 milliseconds. Any value outside this range will cause an error.
return_data returns the following values: 0 No errors.
1 Invalid time delay range.
322 ERROR_TS_WAKEUP (Error given by DosSleep API function).
Example:
The code below illustrates the time delay function and shows how to verify the delay using the REXX function TIME(). Note that TIME() has a resolution of only 10 milliseconds.
delay_value = 500
SAY 'Start delay of ' || delay_value || ' msec...'
verify_delay = TIME('R')
return_data = RTDelay( delay_value )
verify_delay = TIME('E')
SAY "... End Delay. rc = " || return_data
SAY 'elapsed time = ' || verify_delay
Output:
Start delay of 500 msec...
תתת End Delay. rc = 0
elapsed time = 0.520000