WAIT - wait for response statement


[name] WAIT [{EVENT=event}]
            [{TIME={ssssssss}
                   {cntr}
                   {A(integer)}
                   {F(integer)}
                   {R(value1[,value2])}
                   {T(integer)}}]
            [{,UTI=uti}]

Function

The WAIT statement simulates the action of a terminal operator waiting for a reply before entering the next message. This statement can specify an event that must be posted complete before further messages can be generated, or it can specify a delay to be observed until a reply is received or the delay expires. This statement is an unconditional delimiter.

Note: For CPI-C simulations, if a WAIT with no time is specified, an event will be needed to reset the wait.

Where

name
Function: Specifies a name to be used when branching during message generation.

Format: From one to eight alphanumeric characters.

Default: None. This field is optional.

EVENT=event
Function: Specifies the name of an event that must be posted complete before further messages can be generated.
Format: For the EVENT operand, you can enter one of the following options. value can be any integer from 0 to 32766 or a counter specification whose value is within this range. Zero is the offset to the first byte of the field for positive offsets (+value) and the offset to the last byte of the field for negative offsets (-value).
name
Specifies the name of the event to be posted, where name is one to eight alphanumeric characters.
value
Specifies the event name to be referenced at an offset from the start (+value) or back from the end (-value) of the network user area.
value
Specifies the event name to be referenced at an offset from the start (+value) or back from the end (-value) of the device user area.
Ns+value
Specifies an event name to be referenced at an offset from the start of the network save area where s is the network save area and can be any integer from 1 to 4095.
s+value
Specifies an event name to be referenced at an offset from the start of the device save area where s is the device save area and can be any integer from 1 to 4095.
You can use N±value, U±value, Ns+value, and s+value for variable event names. The first eight bytes of data beginning at the offset (value) comprise the name. For the network and device user area, code the name and then pad it with blanks if the length of the name is less than eight. If the area does not exist or no data is present, the name will consist of eight blanks. Because no validity checking is performed on the name, you can use a name that cannot be expressed as EBCDIC characters. You can put the name to be referenced into the save area or user area with a DATASAVE statement.

Default: None.

TIME={ssssssss|cntr|A(integer)|F(integer)|R(value1[,value2])|T(integer)}
Function: Specifies the maximum amount of time to be delayed before continuing in message generation.

Except for CPI-C simulation, if a system reply arrives before the specified time delay has expired, message generation will continue immediately at the point after the WAIT, unless the wait indicator is set by an IF statement.

If the TIME operand is specified, the TIME value overrides the delay value for the message being generated. It is started immediately even if THKTIME=UNLOCK is specified for the terminal.

Format: For the TIME operand, you can code one of the following values:
ssssssss
Specifies a fixed number or seconds, where ssssssss is an integer from 0 to 21474836. If 0 is specified, the WAIT will be treated as if the TIME operand were not coded. If any other integer is specified, the maximum amount of time to wait will be that number of seconds. The delay will not be affected by the UTI value.
cntr
A counter specification whose value is within the range of 0 and 2147483647. For any counter specification value, the maximum amount of time to wait will be the counter value multiplied by the UTI value.
A(integer)
Specifies the maximum wait time will be chosen by randomly selecting a number in the range from 0 to two times the specified integer and then multiplying the number by the UTI value, where integer is an integer from 0 to 1073741823. The average delay will be integer.
F(integer)
Specifies a fixed value, where integer is an integer from 0 to 2147483647. If F(0) is specified, the WAIT will be treated as if the TIME operand were not coded. If any other integer is specified, the maximum wait time will be the integer multiplied by the UTI value.
R(integer)
Specifies that the integer will identify an RN statement, where integer is an integer from 0 to 255. The maximum wait time will be a randomly selected value from the range coded on the RN statement multiplied by the UTI value.
R(value1,value2)
Specifies that the maximum wait time will be a randomly selected value from the range of low (value1) to high (value2) multiplied by the UTI value, where value1 is an integer from 0 to 2147483646 and value2 is an integer from 1 to 2147483647 or counter specifications whose values are within these ranges. The value coded for value1 must be less than the value coded for value2.
T(integer)
Specifies that integer will identify a RATE statement which defines a rate table, where integer is an integer from 0 to 255. The maximum wait time will be a randomly selected value from the rate table multiplied by the UTI value.

Default: None.

Note: You can code either the EVENT or the TIME operands, but not both. If you omit both TIME and EVENT operands, the device will not send another message until the wait indicator is reset. In this case, a normal delay will be used. Refer to Creating WSim Scripts for information on resetting the wait indicator.
UTI=uti
Function: Specifies a UTI which is to be used in calculating this delay. uti must reference a UTI statement defined within the network configuration statement.

Format: From one to eight alphanumeric characters.

Default: None. This field is optional.

Note: The TIME operand must be coded on the WAIT statement for the UTI operand to be valid. If the TIME=integer with no prefix, and UTI=uti operands are coded on a WAIT statement, the statement will be flagged in error. You must code one of the prefix A, F, R, or T before integer when the UTI operand is specified. Furthermore, the UTI operand is not valid if the EVENT operand has been coded.