Previous Topic: VVALUE()

Next Topic: WTO()

WAIT()

Use WAIT() to direct an IMOD to wait for a POST operation on a stack.

Syntax

The WAIT() function has this syntax:

stknum = WAIT(n,[n],[n],...,[n])

Arguments

The WAIT() function takes these arguments:

stknum

Number of the stack that satisfied the requirements for ending the wait (or error text).

n

Number of a stack to wait on. Up to twenty stacks can be waited on. All specified stacks must be empty or WAIT() completes immediately. If multiple stacks are specified, a POST operation issued against any stack causes WAIT() to complete.

Return Codes

The WAIT() function produces these return codes:

101 - 120

ARG n MISSING OR INVALID

121

NO STACKS SPECIFIED

Example

num = wait(1,2,3)   /* Wait for a record to appear on any of 3 stacks    */
rec = pull(num)     /* Read the record that caused the wait  to complete */

Usage Notes

When a WAIT() is issued against one or more stacks, each specified stack is inspected for existing records. If any records are found, no wait is performed. Following completion of the function, the number of the first non-empty stack is returned as the function's result.

When a WAIT() is issued against empty stacks, the IMOD task is suspended. Execution is resumed when another IMOD task uses a function that specifies post, such as PUSH(), QUEUE(), and SHOVE(). The function providing the post may provide accompanying stack records.