Previous Topic: PULL()

Next Topic: QUEUE()

PUSH()

Use PUSH() to add records to the top of any stack belonging to any IMOD.

Restriction

PUSH() can specify a stack external to an IMOD only when the target stack has been declared public for writing by the owning task.

Syntax

The PUSH() function has this syntax:

PUSH([record],[stack],[owner],,[postoption])

Arguments

The PUSH() function takes these arguments:

record

Record to be added to the stack. A zero-length record is added by default.

stack

Number of the stack to be referenced.

Default: If a local stack is referenced, the current stack (as set by the SWAPSTAK() function); otherwise, the value is set by the owning IMOD task using the PUBSTACK(DEFAULT) function.

owner

IMOD ID of the stack's owner (for external reference). This value can be obtained from the variable imod_id in the owning IMOD task. It is also the value returned by the SPAWN() function. The default is the current IMOD task.

postoption

Wait option that determines whether the owning IMOD waits for a record to appear on an external stack. Specify one of these values.

POST

Any outstanding wait is satisfied; default.

NOPOST

An outstanding wait is not satisfied.

ONLYPOST

Any outstanding wait is satisfied, but a record is not placed on the stack.

Note: If you are placing several records onto an external stack, CA recommends that you specify NOPOST for all but the final record. IMODs are time-sliced, and if the POST operation is performed before the final record is pushed on the stack, the IMOD task owning the stack could be dispatched to process before the final PUSH is completed.

Return Codes

The PUSH() function produces these return codes:

101 - 105 ARG n INVALID

122 STACK NOT SPECIFIED AND NO DEFAULT

123 SPECIFIED STACK DOES NOT EXIST

125 SPECIFIED IMOD NOT FOUND

126 STACK WRITE FAILED

127 REQUESTED STACK DOES NOT EXIST

128 SPECIFIED IMOD/STACK NOT AUTHORIZED

Example

x = push(rec)               /* A record is written to the
                               current stack */
x = push(rec,2)             /* A record is written to local
                               stack 2 */
x = push(rec,,453,,'post')  /* A record is written to IMOD 453's
                               default stack. Any outstanding
                               wait will be marked complete. */