WaitHostQuiet Method



Applies To Objects



Waits for the host to not send data for a specified number of milliseconds. The Screen object will wait for host compliance for the amount of time set in System.TimeoutValue.


object.WaitHostQuiet [SettleTime]

rc = object.WaitHostQuiet( [SettleTime] )

Set waitobj = object.WaitHostQuiet( [SettleTime] )




The Screen object.


The amount of time, in milliseconds, that the host should remain "quiet." If SettleTime is not specified, a default time of 5000 (5 seconds) is assumed.


Return value for the second syntax form above. If TRUE, the host was quiet for SettleTime milliseconds. If FALSE, the host was NOT quiet.


The Set statement, required for assigning an object reference to a variable.


A wait-type object.


This method can be used to allow time for the host to "settle down" during potentially busy periods. For instance, in a 3270 session, WaitHostQuiet is useful after issuing a SendKeys call that contains an Aid key. The Aid key can result in a change to the host screen and the host will issue Xclock (busy) messages during this time. Issuing a WaitHostQuiet call after the SendKeys call pauses processing of your macro until the host has remained quiet for 5 seconds.

There are two values that can affect the performance of WaitHostQuiet. These values will need to be set according to the performance of your particular host environment. The SettleTime parameter controls the amount of time you want the host to "be quiet." the default (5000) means "wait until the host has been quiet for 5 seconds." In some instances, you may want to pass in 0. For example, in a 3270 session, WaitHostQuiet(0) means "wait until the XClock clears."

The second value that can affect the performance of WaitHostQuiet is System.TimeoutValue. This value controls how long the macro should keep waiting for the quiet condition to occur before returning TRUE or FALSE. For example, if System.TimeoutValue was set to 30000 (30 seconds) and a WaitHostQuiet(10000) is issued, you are requesting to "wait for the host to be quiet for 10 seconds and if this hasn't happened in 30 seconds, return FALSE."


WaitForString, WaitForStream, WaitForCursor, and WaitForCursorMove are other possible options for determining when the host has finished processing.



Macro Recording on Asynchronous Hosts -The macro recorder automatically inserts WaitHostQuiet statements after every SendKeys operation. For asynchronous hosts, the default Wait time may be too long. This can easily be modified. For example, to wait for only two seconds (rather than the default five), change all the WaitHostQuiet statements to wait for a specific user-defined timeout value and define that value at the start of the macro. Then, when you want to change the value of the Wait time, you only have to make the change in one place. For example:

'define this once at start of macro
WaitValue = 2000

'change each WaitHostQuiet statement to
'wait for this user-defined time
WaitHostQuiet (WaitValue)


When either of the first two syntax forms above is used, WaitHostQuiet will suspend execution of your macro or program (i.e. wait) until host is not busy for at least SettleTime milliseconds, or a timeout occurs. If the third form is used, WaitHostQuiet will return immediately and the wait-type object returned can be used with the Waits collection, which allows several separate events to be monitored simultaneously. For more information on this, see help for the Waits object.