Caché ObjectScript Reference
Suspends execution for a specified number of seconds.
||Optional A postconditional expression.
||The amount of time to wait, in seconds. An expression that resolves to a positive numeric value, or a comma-separated list of numeric expressions.
suspends the executing routine for the specified time period. If there are multiple arguments, Caché suspends execution for the duration of each argument in the order presented. The HANG
time is calculated using the system clock, which determines its precision.
has the same minimum abbreviation (H) as the HALT
is distinguished by its required hangtime
An optional postconditional expression. Caché executes the HANG
command if the postconditional expression is true (evaluates to a nonzero numeric value). Caché does not execute the command if the postconditional expression is false (evaluates to zero). For further details, refer to Command Postconditional Expressions
in Using Caché ObjectScript
The amount of time to wait, in seconds. This time can be expressed as any numeric expression. You can specify hangtime
as an integer to specify whole seconds, or as fractional number to specify fractional seconds. You can use exponentiation (**), arithmetic expressions, and other numeric operators.
You can set hangtime
to 0 (zero), in which case no hang is performed. Setting hangtime
to a negative number or a nonnumeric value is the same as setting it to 0.
You can specify multiple hangtime
arguments as a comma-separated list, as described below.
The following example suspends the process for 10 seconds:
The following example suspends the process for 1/2 second. $ZTIMESTAMP
, unlike $HOROLOG
, can return fractional seconds if the precision
parameter of the $ZTIME
function is specified.
Returns values such as the following:
You can specify hangtime
as a comma-separated list of numeric expressions. Caché suspends execution for the duration of each argument in the order presented. Negative numbers are treated as zero. Therefore, a hangtime
of 16,-15 would hang for 16 seconds.
That each hangtime
argument is separately executed can affect operations that use the current time in hang calculations, as shown in the following example:
WRITE !,"elapsed hang=",end-start
In this example, HANG first suspends execution for 4 seconds, then suspends execution for the current time before the hang plus 5 seconds, minus the current time when the second hang argument is parsed. Because HANG
executes each argument in turn, the total hang time in this example is (roughly) 5 seconds, rather than the (roughly) 9 seconds one might otherwise expect.
HANG Compared with Timed READ
You can use HANG
to pause the routine while the user reads an output message. However, you can handle this type of pause more effectively with a timed READ
command. A timed READ
allows the user to continue when ready, but a HANG
does not because it is set to a fixed duration.