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:
Multiple HANG Arguments
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.
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.
HANG and ^JOBEXAM
command is used to pause execution of the current process.
utility can be used to suspend and resume execution of other running processes; it cannot be used to suspend execution of the current process. You cannot use ^JOBEXAM
to resume process execution that has been paused by a HANG
command. If you use ^JOBEXAM
to suspend a process that has been paused by a HANG
command, the ^JOBEXAM
resume activates the process, which must complete whatever portion of the HANG
time that remained when it was suspended.
displays State information about all running processes. A process that is paused by a HANG
command is listed as State HANGW. A process that is suspended by ^JOBEXAM
is listed as State SUSPW.
utility must be invoked by the Terminal from the %SYS namespace. You must have appropriate privileges to invoke this utility. Utility names are case-sensitive. You can execute ^JOBEXAM
: displays a listing of all running processes. It provides letter code options to terminate, suspend, or resume a running process.
displays a listing of all running processes. It does not provide options to terminate, suspend, or resume a process.