Setting A Unique @STATION Variable in Terminal Server and CTO Environments (Functions/Subroutines/Programs)
Created at 23 JUN 2010 03:09PM
Overview
OpenInsight applications are easily configured to run from Terminal Server environments. Often the only change needed is to make the variable @STATION unique. In a client / server LAN environment the @STATION variable is always unique across running instances of the application because Windows enforces unique station names on the network. In a terminal server environment @STATION is identical across all instances of the application on the terminal server because multiple applications are simultaneously running on the same machine. Most application developers prefer @STATION be unique for each running instance of the application.
By default CTO (Character To OpenInsight) applications have identical @STATION values. A CTO window executes inside the OEngineServer service on the database server which results in @STATION containing the name of the server and not the client where the window is running.
The article guides you through changing your application's @STATION variable to contain a unique combination of username and process id for CTO and terminal server environments.
Directions
1. Open your application in development mode.
2.
3. Create a new procedure named SET_STATION.
4.
5. Copy the attached SET_STATION.txt file into the new routine.
7.
8. Save and compile the routine.
9.
10. Open the record SYSENV*ENV_APPLICATION where APPLICATION is the name of your application.
11.
12. On field 32 (line 32) add SET_STATION*APPLICATION where APPLICATION is the name of your application. The image below demonstrates the field to change and value to enter if you were working in the examples application.
14.
15. Save SYSENV*ENV_APPLICATION and close OpenInsight
Start your application on the terminal server or in CTO mode and check the value of @STATION. You'll notice the value is now a combination of username and process id.
The SET_STATION routine is customizable. The @STATION variable is commonly used as a record key to store workstation specific settings between instances of the application. If this situation applies to your application you may choose to rewrite SET_STATION to return a specific value of the current username and client's workstation name that will persist between terminal server sessions.