You can initialize model variables in several ways using the Host Integrator:
- Using the Design Tool, you can use this dialog box to define and initialize model variables.
- Using the Host Integrator Server, you can override a variable value stored in the model file using session pooling.
- Using an AppConn API, you can change the value of a variable using the SetModelVariable method.
If host data is accessed through a procedure, you should avoid using variables in combination with a procedure unless there is no other alternative. You may find you need to use ReadVarFromAttr and WriteVarToAttr commands to pass data between screens, but all client data should be passed in and returned through the table itself.
The primary advantages of using variables are to provide abstraction from entities and to enable attributes to be accessible from all parts of the Host Integrator. See the Verastream Administrative Console help for information about initializing variables from a session pool model variable list during server execution.
The Variables dialog box contains a list of defined variables. By default, the Design Tool provides the following predefined variables:
The userID and password variables should be initialized at connection since the data for these variables will change each time a new user connects to a host. Under Initialization in the Initialize variable box, select Initialize variable at host connect for both the userid and password variables.
To add/delete a new variable
Click New. The Design Tool provides a default name, such as Variable1. To change the default name, select it in the Variable name box under Properties.
Click Delete. If you try to delete a variable that is in use, the Design Tool warns you that the variable in question is in use and cannot be deleted.
A variable can be associated with an attribute and used for conditional operations and data fetching. For more information, see the Attribute Variables tab in the Entity window.
Properties tab options
Variable name - Type a unique name to programmatically identify the variable in the model file. When you rename a variable, the Design Tool checks all references to it and updates them.
Current value - Type the value currently assigned to the selected variable. This is the value used by the Design Tool for testing the model file before deploying it to the Host Integrator Server. If a model variable is mapped, the Initialize Variable setting uses the current value as the initialization default.
Map to setting - If the value of the selected variable can be matched to any of the provided settings, select it from the list.
If you are working with a model which was created with a previous version of Host Integrator, the private key, public key, and passphrase variables will not be visible in the Map to Setting list. You will have to create them by clicking New.
Mapping a setting to a variable allows you to access Host Integrator session features at server runtime. For example, if a connector needs to specify a Telnet Terminal ID that may change from session to session, you can create a variable and map it to the Telnet Terminal ID setting. Another example is mapping the userID and password variables to the Host User Name and Host Password settings to access the AS/400 autosignon feature. If you are not going to utilize this autosignon feature, you should set the userID and password variables to (None).
Encrypt value - Encrypts the value of the variable in the model file.
Hidden - Makes the variable inaccessible to the Host Integrator connector after it has been deployed to the Host Integrator Server but still accessible from the model file when its opened in the Design Tool.
Read - Allows the variable value to be readable from a Host Integrator connector.
Write - Allows the variable value to be writable from a Host Integrator connector. A variable must be either read or write, or both read and write, or hidden.
Type a description of the selected variable to be included in the documentation generated when using the options in the Export dialog box. In the sample models provided with the Design Tool, a description is provided for all pre-configured variables.
The following options allow you to define when and how to initialize each variable after the model file has been copied to the Host Integrator Server:
Select one of the settings below to specify when a variable should be initialized. If a model variable is mapped to a setting, the Current Value displayed in Properties is the initialization default.
- Initialize variable with default value— The variable will be initialized with the value specified in the Default value box during Host Integrator Server execution. In the Design Tool, the variable is initialized with the value specified in the Design default box.
- Require initialization at client connect— The server will require that an initial value be provided at runtime. This value may be passed as part of the Connect() API function Failure to provide a value will result in an initialization exception. When a user is connecting to a host from the Design Tool, the user is prompted with a dialog box to enter values for all variables marked with this option.
Variable not initialized— Variables with this setting will remain uninitialized through session initialization. From within the Design Tool, right before an operation is performed, the user is prompted with a dialog box to enter values for all variables used in that operation that are marked with this option. The variable remains uninitialized until a value is written to the variable by an operation or a Host Integrator connector method.
If values are always supplied by model variable list entries or session pool model variable configuration, it is appropriate to select this option to avoid user prompting.
If an uninitialized variable is accessed by a Host Integrator Server (for example, if a WriteVarToLocation command is issued), the server will issue an exception and halt the current activity.
Type the default value that will represent the selected variable on the Host Integrator Server.
Type the default value that will represent the selected variable in the Design Tool.