# WAIT

## Syntax:

    WAIT('ECB',ecbad[,longwait])

    WAIT('ECBLIST',ecblad[,eventno][,longwait])

    WAIT('SEC',seconds)

## Arguments:

ecbad
  the address, in the REXX printable hexadecimal format (e.g., '1FC0') of the Event Control Block (ECB) to WAIT on until posted as completed. The ECB must be 4 bytes wide, and must be initialized to binary zeros.
ecblad
  the address, in the REXX printable hexadecimal format (e.g., '1FC0') of the Event Control Block (ECB) List to WAIT on until posted as completed. Each 4 byte wide element in the list points to a standard 4 byte ECB. The last address in the list has the high order bit (bit zero) turned on.
eventno
  the number of events to wait on (in ecblad) until completed. The eventno argument must be a number that is equal to or less than the number of events in the ECB list pointed to by ecblad.
longwait
  indicates whether the task will be in a "long wait" (such as waiting for terminal input) or not. The possible values are 'YES' to indicate a long wait will take place, and 'NO' to indicate that no long wait will take place.
seconds
  the number of seconds to wait before returning control to the REXX program. This argument is specified as a REXX printable integer between 0 and 86400 (the number of seconds in 24 hours).

## Module Name:

SWXWAIT

## Service Description:

The WAIT function is used to stop the execution of the REXX program until one or more events have completed. Optionally, the WAIT function, in its 'SEC' format, may be used to wait for some number of seconds to pass before returning control to the program.

## Returned Information:

Depending on the type of WAIT you specify, the function may or may not return a useful return code. If you specify an ECB WAIT, the return code is take from the completion code field of the posted ECB (see the POST function). If you specify an ECBLIST WAIT, the return code is the largest of the return codes in the list pointed to by ecblad. If you specify a SEC WAIT, the WAIT function always returns a value of zero.

If you CALL the WAIT function, the RESULT special variable will contain the value of the return code. In addition, the RC special variable is set to contain the return code value.

## Examples:

1. Call the WAIT function to wait on the ECB pointed to by MYECB:

       call wait 'ecb', myecb

2. Call the WAIT function to wait for 10 seconds:

       call wait 'sec', 10

© Copyright 1998 by Open Software Technologies, Inc.