You can define watch commands to monitor any of the following:
•Change of screen size
•The contents of a string at a certain position within the screen buffer
•The cursor position
•The Input Inhibited indicator (II) in the Operator Information Area, or the "X" status
You can tailor the watch command sequences to the way your host operating system and application update the terminal screens. It will be easier for you to define appropriate watch command sequences by first answering the following questions on how the screens are updated:
•Does the screen size change when a new screen arrives?
•When does the Input Inhibited indicator in the Operator Information Area appear and disappear? Does it flicker as characters are written to the screen? Does it stay on continuously while waiting for the host to respond, or does it go on only when the host is transmitting?
•Does the cursor position change from the previous screen? If so, when after the Input Inhibited indicator disappears, or just before?
•Which characters will change from the previous screen? Which ones will stay the same? Will the screen be cleared before the next screen is displayed?
The answers to these questions will enable you to write ESL code that determines when the 3270/5250 screen buffer has been completely updated.
You should define a watch for each screen in your host system. The watch should specify the smallest set of unique conditions which, under all performance situations, allow you to determine that the screen has arrived completely. It is rare that any one condition is sufficient; therefore, you should add more conditions to your watch. As a general recommendation, the last condition in each watch should be EcsWatchForIIOff, since the Input Inhibited indicator may flicker.
One method for defining a successful watch is to look for the last thing to arrive at a screen, and work backwards toward the EcsWatchForIIOff. For example, the first thing you can look for is for the cursor to appear at its resting position. The positioning of the cursor is typically the last thing that is done during a screen transmission. Other items that can be watched for are unique strings that appear with the screen. In most cases, once an adequate watch has been defined, you can set the settle time to zero. Again, you may want to experiment and fine-tune for your host.
Since a watch is a string built by ECS, you can define your watches ahead of time, using a separate string variable that has a meaningful name in the program for each watch. You can then use these watches repeatedly without rebuilding.
The action routine in the following example defines a watch for a screen with the string "WELCOME" in row 2, column 1:
string
WatchForWelcome_SV action DefineWatchForWelcome is
call EcsClearWatch ( WatchForWelcome_SV )
copy 3 to Row_IV
copy 1 to Column_IV
call EcsWatchForCursorAt ( Row_IV, Column_IV,
WatchForWelcome_SV )
copy 2 to Row_IV
copy 1 to Column_IV
copy "WELCOME" to WatchFor_SV
call EcsWatchForStringAt ( Row_IV, Column_IV, WatchFor_SV,
WatchForWelcome_SV )
copy 0 to SettleTime_IV
call EcsWatchForIIOff ( SettleTime_IV, WatchForWelcome_SV )
Because the watch commands are executed sequentially, one at a time, you can build a watch command string that allows you to navigate through multiple host screens. For example, if by pressing a special host function key, the host goes through two intermediate screens before arriving at the final destination. You can build your watch string to look for the arrival of the first screen, then the second screen, followed by the destination screen.