The SLEEP statement causes the program in which it is executed to pause for a given number of seconds or until a specific time. The synonym RQM may be used in place of SLEEP.
The SLEEP statement operates in one of two ways depending on the format of time.
If time is a number, it is rounded to an integer value and the program sleeps for that number of seconds. If time is negative or zero, the program continues without sleeping. See NAP for a way to pause for less than one second.
If time is not a number, an attempt is made to convert it to a time of day using any of the formats accepted by the ICONV() function MT conversion. If successful, the program sleeps until this time. If the time of day specified by time has already passed, it is assumed to be a reference to that time on the following day. If time cannot be converted to a time of day, the program continues without sleeping.
In all cases, if there is more than one process running, the SLEEP statement causes a process switch to occur. It can therefore be used to relinquish the remainder of the timeslice of the current process if waiting for some event to occur in another process, such as release of a lock.
The actual sleep time may vary from that specified due to process scheduling actions within the operating system.
If the break key is used to interrupt a program which is sleeping, selection of the G option will continue to sleep to the specified time. The Q option will abort the program immediately.
This statement causes the program to sleep until half past ten at night.
This statement causes the program to pause for 10 seconds