Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the sleep equal function for rexx on windows?

Status
Not open for further replies.

davecw

Programmer
May 23, 2003
3
US
What is the sleep(wait) equal function for rexx on windows?

Anyone knows what function could be used for REXX on Window platform to serve the sleep or wait purpose?
The program is to run a sql query every 5 minutes. I could not find the sleep or wait function for REXX on the window platform. Any help is appreciated.
 
you can design your own wait function easily using the time function
Time('m') returns the time elasped, after midnight, in minutes
_____________________________________

...........
..........
MyWait(5)
.........
........

MyWait:

Parse Arg Min
TimeDiff = 0
StartTime = Time('M')
Do Until TimeDiff = 5
TimeDiff = Time('M') - StartTime
End
Return

________________________________________
Hope this helps

cheers
ashish

 
sorry ...i just did a mistake
use the code below

..........
MyWait(5)
.........
........

MyWait:

Parse Arg Min
TimeDiff = 0
StartTime = Time('M')
Do Until TimeDiff = Min
TimeDiff = Time('M') - StartTime
End
Return
 
Ashish,
Thank you for the info. There are two questions after I tried it.
1) The procedure MyWait(5) doesn't work with TimeDiff = Min from Parse Arg Min. It has to be TimeDiff=5 as you did the first time. For some reason, the CALL MyWait(5) doesn't pass the value of 5 to arg Min.
2) Tried it with TimeDiff=1 (1 minutes) and counted the times of try it totaled in 1 minute period. The totoal count is 3060679. Doesn't it consume a lot of resource imagining that if it needs to run every 5 minutes for 24X7?

Thanks,
davecw
 
DaveCW, I think you are looking for the SysSleep e.g;

>>-SysSleep(secs)---><

Pauses a REXX program for a specified time interval.

Parameter:

secs

The number of seconds for which the program is to be paused. You can specify up to seven decimal places in the number.

Example:

Say &quot;Now paused for 2 seconds ...&quot;
Call SysSleep 2
Say &quot;Now paused for 0.1234567 seconds ...&quot;
Call SysSleep 0.1234567

Call SysSleep 0.12345678 -- Error 40: Incorrect call to routine


Also, I would recommend against using a &quot;DO UNTIL&quot; etc to acheive this as the constant variable comparison will test the performance of your platform. Programs / built-in functions usually use a call to the system clock which is more efficient. This is especially true if you are running on a mainframe.
 
KiwiREXXDude, That is cool. It is always good to have alternative, especially a good one. You did your good deed today. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top