The Pine model is an example of a VT host application model but includes several features that could also be applied to a 3270 host application model.
To open pine.model:
The Pine Model demonstrates the Design Tool capabilities discussed below. When you work with VT models, it is critical that you take host synchronization into account. See Host Integrator Synchronization Techniques for more information.
This model demonstrates the Design Tool's ability to override the cursor movement of a character mode host. By default, the Host Integrator calculates and issues the correct number of arrow key commands to change the cursor position, but many character mode hosts do not respond to this behavior. In this version of Pine, issuing arrow keys in the default manner did move the cursor, but the peculiarities of the host application caused the cursor to be moved to the wrong location. The up and down arrows are actually sufficient to change fields, so the model designer who created pine decided to override the default mechanism. See the Cursor tb on the AddAddress and UpdateAddress entities.
Another common issue with character mode hosts is tabstops. For example, issuing a move cursor command may cause the host to move the cursor first to a status line to update the text, and then to its desired location. By default, Host Integrator will issue a move cursor command and then wait for the cursor to change position. If the scanning mechanism sees the cursor in the status line, Host Integrator will assume the status line location is the new position and issue another move command in an attempt to reach the desired location. This is a good example of how the Host Integrator might get ahead of the host. For a screen defined as an entity, you can get around this by defining tabstops. These constitute all the valid "at rest" positions for the cursor on that screen; therefore, if tabstops are defined, Host Integrator will wait for the cursor to appear in one of these locations after issuing a move cursor command and before evaluating whether the desired location has been reached. See the Cursor tab on the Entity window for details. The Pine model uses the location of writable attributes as tabstops.
On the Model menu, click Properties to open the Model Properties dialog box to view the login and logout command lists created for Pine model. Command lists can help bypass the many host prompts encountered in the login sequence before actually getting to the host application. The command list is generic for any user based on WriteVarToTerminal. An API connector can set model variables with the correct userid and password at session connect, and those values would in turn be used by the login command list using the WriteVarToTerminal command.
The AddressBook entity demonstrates some techniques, such as including scrolling operations and setting termination conditions, to keep recordsets synchronized with the host. You can create scrolling operations that use the TransmitTerminalKey command assigned to the keystroke from which you expect to elicit a host response and then make Host Integrator wait for the host to respond with something other than a character echo. You can also verify the host response with one or more Host Events commands. For examples of scrolling operations, see the LineUp, LineDown, PageUp and PageDown operations defined on the AddressBook entity. Failure to wait would result in API calls, such as SelectRecordByFilter, executing the selection operation while the host is still trying to highlight the desired record, which may cause fetches or updates to access the wrong entry. Search for "SelectRecordByFilter" in the Host Integrator API Reference for more information.
In addition, the termination conditions for filtering the last screen allow Host Integrator to accurately detect the end of a recordset. By limiting it to non-blank records, Host Integrator correctly identifies the last record on the screen and remains synchronized with the host. Omitting this property causes Host Integrator to treat all entries as records. After a fetch call, Host Integrator assumes the host is at the bottom position of the screen instead of at the last non-blank record. Keeping the current record in line with the host is critical for character mode applications or any other recordsets that require line up and line down operations.