Previous Topic Next topic Print topic


C$SLEEP

This routine causes the program to pause in a machine efficient fashion.
Note: This ACUCOBOL-GT library routine is available in this COBOL version. Any compatibility issues in this COBOL system are in the Compatibility Issues section at the end of the topic.

Usage

CALL "C$SLEEP" 
    USING NUM-SEC

Parameter

NUM-SEC Numeric or alphanumeric parameter The number of seconds to sleep.

This parameter is a an unsigned fixed-point numeric parameter, or an alphanumeric data item containing an unsigned fixed-point number.

Description

This routine can be used to impose slight delays in loops. For example, you might want to introduce a delay in a loop that is waiting for a record to become unlocked. Calling C$SLEEP will allow the machine to execute other programs while you wait.

The C$SLEEP routine is passed one argument. This argument is the number of seconds you want to pause. For example, to pause the program for five and a half seconds, you could use either of the following:

CALL "C$SLEEP" USING 5.5
CALL "C$SLEEP" USING "5.5"

The amount of time paused is only approximate. Depending on the granularity of the system clock and the current load on the machine, the time paused may actually be shorter or longer than the time requested. Typically, the time paused will be within one second or one-tenth of a second of the amount requested (unless the machine is excessively loaded).

If the sleep duration is zero, this function does nothing. If the sleep duration is signed, this function generates a runtime error.

Compatibility Issues

None
Previous Topic Next topic Print topic