ECS provides you with two subroutines to execute your watch command strings:
This subroutine executes each of the watch commands specified in your watch string, while allowing your application to continue to respond to other events that do not pertain to the screen buffer (such as object selections and keyboard input). The ESL program determines if the watch commands have executed successfully by responding to the stimulus events ECS_WATCHDONE, ECS_WATCHGAVEUP, or ECS_WATCHERROR from the ECS DLL. (See Part II for more detailed information.)
EcsWatchAndWait is implemented using EcsWatch with a guarded block. EcsWatchAndWait executes each of the watch commands specified in your watch string, one at a time, and in sequence until all the commands have been successfully executed, or a period of time specified by a time limit has elapsed.
Each of the watch subroutines operates on a specified string variable that is the name of the watch you are specifying. None of these subroutines actually send HLLAPI commands. By calling these subroutines in the appropriate order, you can set the value in a string variable that you ultimately pass to the subroutine EcsWatch or EcsWatchAndWait.
Each watch definition subroutine encodes the requested watch command by appending some characters to the global string variable EcsWatchCommandString or the user-defined watch string. These characters are interpreted by at the time the watch commands are executed. (The contents of watch strings are managed by , so it is not necessary to know how the commands are encoded.)
The subroutines EcsWatch and EcsWatchAndWait cause the current watch command sequence to be executed. Normally, one of these is called immediately after sending a keystroke that causes the host to begin transmitting a new screen.
For an example, see watch command string code. For more detailed information about these subroutines, see the Summary of ECS Subroutines.