Environment Variables
This chapter describes the environment variables used by Tmax system, and how to configure them.
1. Overview
There are two types of Tmax environment variables in the configuration file: system variables and server process variables. Most of the Tmax environment variables are used to access Tmax system. The same values should be specified for the environment variable in this chapter as for the items in the configuration file introduced in the next chapter. These variables will affect all server processes in the system.
On client-only machines, Tmax environment variables can be configured in one of the following two ways:
-
In the shell’s profile.
-
As a file in the standard Tmax configuration file format.
Server process variables must be configured in a standard Tmax configuration file, and the file must be defined in the ENVFILE section of the configuration file.
2. Tmax Environment Variables
All clients and servers where Tmax is installed use the same environment variables, but there is no need to separately configure the environment variables of all Tmax nodes in the clients.
2.1. Tmax Server Configuration Variables
The following are environment variables configured on the server.
Variable | Description |
---|---|
TMAXDIR |
Home directory of Tmax system (Configuration file item: TMAXDIR). |
TMAX_BKAPPDIR |
The directory, where a new process will be placed, when changing the existing server process. |
TMAX_HOST_ADDR |
IP address of the server where Tmax will run on. Loads are balanced as clients are randomly connected to servers. For more information, refer to Registering Multiple Servers. |
TMAX_HOST_PORT |
Port number for accessing Tmax (Configuration file item: TPORTNO). |
TMAX_BACKUP_ADDR |
IP address of a Tmax backup server. |
TMAX_BACKUP_PORT |
Port number of a Tmax backup server. |
TMAX_RAC_PORT |
Port number used by racd for centralized management of a system with distributed nodes (Configuration file item: RACPORT). |
TMAX_ERR_MSG |
Option to display error messages on the server console ("Y" or "N"). |
SDLFILE |
File where structural information is stored. |
FDLFILE |
File where field key information is stored. |
TMAX_PATHDIR |
Environment file path that is referred to during tmdown (Configuration file item: PATHDIR). |
TMAXHOME |
To use the install directory and the work directory separately, set as follows. (Configuration file item: TMAXHOME)
|
TMAX_SEMANTICS |
Action to take according to the length of an FML buffer inside functions that read data (fbget, fbget_tu, fbget_tut, fbgetf, fbgetlast_tu, fbnext_tu). Enter the data length as the last argument of the function to verify the user-assigned buffer. This is used to prevent error when the size of the user-assigned buffer is smaller than the actual data size. |
TMAX_TRACE |
Option to enable runtime tracing of Tmax application execution. |
TMAX_DEBUG |
Name for the file to which a client’s debugging and error logs will be recorded, instead of the screen. Specifying '.pid' at the end of the configured log file name automatically modifies the file name as the PID of the process that executes the affected part. The creation date is always added to the end of the specified log file name. |
TMAX_STRING_NULL |
Option to allocate a STRING type buffer by using the tpalloc or tprealloc API. If the user requests for service with data that fills up to the last one-byte space designated for NULL in the allocated buffer, a TPEINVAL (client) and TPESVCERR (server) error occurs. In such case, an additional one-byte buffer can be allocated and automatically set to a NULL character by setting this option to Y. |
TMAX_HOST_IPV6 |
Set to 'Y' if an address set in the TMAX_HOST_ADDR variable uses the IPv6 protocol. |
TMAX_BACKUP_IPV6 |
Set to 'Y' if an address set in the TMAX_BACKUP_ADDR variable uses the IPv6 protocol. |
TMAX_WEBADM_IPV6 |
Option to use the IPv6 protocol when twagent (Tmax WebAdmin agent) listens from TMAX_WEBADM_PORT. Set to 'Y' to use IPv6. |
TMAX_RAC_IPV6 |
Option to use the IPv6 protocol when executing 'connect' or 'listen' from a racd daemon process that is used for integrated management of a distributed system.
Only used when the [-k] option is used to start racd. SYSTEM_IPV6 setting will be used instead when a Tmax binary environment file is used to start racd. |
TMAX_IPV6_LINK_IF |
New network interface name to use if Tmax processes cannot recognize the interface index of a network interface name when executing 'connect' or 'listen' in an environment that uses the IPv6 protocol. |
TMAX_TENC_CIPHER |
Encryption method related to the SEED encryption/decryption utility that can be set in Tmax configuration file. If set to non-SEED or not set, an existing encryption method is used. |
TMAX_TENC_KEYFILE |
Secret key location. Must be defined to use the SEED encryption algorithm. |
TMAX_APPLY_IPCPERM |
When a server starts for the first time, permissions of log files that are written by specifying the -e and -o options are determined according to IPCPERM set in the DOMAIN or NODE section.
|
TMAX_FDL_LONGSIGN |
Option to preserve the sign of a long-type value in FDL. (Default value: N) In FDL, the actual size of a long type is 4 bytes. When mapping a long value from C to FDL, differences in the expressible range between environments can cause incorrect value conversion. Only values within the 4-byte range are compatible; however, sign preservation is not guaranteed in some cases. For example, in a 32-bit environment, setting '-2' to a long variable and then storing the field value to a long variable in a 64-bit environment may result in a positive value instead of the original negative value. To preserve the original sign of long values within the 4-byte range, set this environment variable to 'Y'. [CAUTION] Due to compatibility limitations in heterogeneous systems, the maximum representable size for a long type in FDL is 4 byte integers. If a long value exceeds INT_MAX, its sign may not be preserved correctly during conversion. For example, the following issues may occur:
|
TMAX_XA_DLL |
When setting an XA server group using Oracle database in Windows, TMAX_XA_DLL or ORACLE_XA_DLL must be configured with a name for the Oracle client dll that contains the actual xa_switch. (Example: TMAX_XA_DLL=ORACLIENT10.DLL) |
TMAX_PRB_1002 |
When a function waiting for a response receives a signal, TPGOTSIG is returned immediately. If this option is set to Y, the function waits for the specified BLOCKTIME even if a signal is received, regardless of whether the TPSIGRSTRT flag is set. |
TMAX_STRING_NULL is only supported for buffers allocated through tpalloc or tprealloc, and works similarly in both the server and client. Note that the variable must be set to Y. |
The following is an example of setting TMAX_SEMANTICS. If a user-specified buffer size is smaller than the actual data size, the data is truncated to the buffer size before being written to the buffer.
TMAX_SEMANTICS="FDL_LEN=TRU"
If the following is set, an FBENOSPACE error occurs when a user-specified buffer size is smaller than the actual data size.
TMAX_SEMANTICS="FDL_LEN=ERR"
If the following is set, a user-specified length is ignored, and Tmax runs with the assumption that the user has allocated a buffer with sufficient length. This setting is valid only when the data length is specified as the last argument of the fbget type function. If the last argument is specified to 0 or NULL, Tmax runs with the assumption that the user allocated a buffer with sufficient length.
TMAX_SEMANTICS="FDL_LEN=OLD"
2.2. Tmax Client Environment Variables
The following are environment variables configured on the client.
Variable | Description |
---|---|
TMAX_HOST_ADDR |
Tmax system IP address. |
TMAX_HOST_PORT |
Tmax system port number. |
TMAX_CONNECT_TIMEOUT |
Timeout value for connecting to Tmax (x.xxx seconds). |
TMAX_TPSTART_TIMEOUT |
Timeout period in seconds for registering the Tmax system after nework connection is complete. (Default value: 60) |
SDLFILE |
File where structural information is stored. |
FDLFILE |
File where field key information is stored. |
ULOG (or ULOGPFX) |
Client side log path. If the path is not specified, the log will be recorded in ULOGDIR of the Tmax environment file. |
TMAX_TRACE |
Option to enable runtime tracing of Tmax application execution. |
TMAX_SEMANTICS |
Action to take according to the length of an FML buffer inside functions that read data (fbget, fbget_tu, fbget_tut, fbgetf, fbgetlast_tu, and fbnext_tu). Refer to Tmax Server Configuration Variables. The encryption function is provided for stable data transmission between a client and the server. |
TMAX_DEBUG |
Name for the file to which a client’s debugging and error logs will be recorded, instead of the screen. Specify the file in the format 'directory/filename'. If the file name ends with '.pid', the client’s process ID (PID) is automatically appended to the name. |
TMAX_ERR_STDOUT |
If set to Y when TMAX_DEBUG is used, errors are recorded in the log files while also being printed in the terminal screen. |
TMAX_HOST_IPV6 |
Set to 'Y' if an address set in the TMAX_HOST_ADDR variable uses the IPv6 protocol. |
TMAX_BACKUP_IPV6 |
Set to 'Y' if an address set in the TMAX_BACKUP_ADDR variable uses the IPv6 protocol. |
TMAX_IPV6_LINK_IF |
New network interface name to use if Tmax processes cannot recognize the interface index of a network interface name when executing 'connect' or 'listen' in an environment that uses the IPv6 protocol. |
TMAX_CLH_TCP_OPTION |
CLH socket option. When tpstart is executed in a client program, a CLH connection is created. This option allows configuring TCP_NODELAY. Set either 'YES' or 'NO'. The default value is 'NO'.
|
TMAX_CLI_TCP_OPTION |
When tpstart is executed in a client program, a CLH connection is created. This option allows configuring TCP_NODELAY. Set either 'YES' or 'NO'. The default value is 'NO'.
|
TMAX_ACTIVATE_AUTO_TPSTART |
Set either 'Y' or 'N'. The default value is 'Y'.
The following functions are affected by this variable. tpcall(), tpacall(), tpcallsvg(), tpacallsvg(), tpconnect(), tpchkunsol(), tpsetunsol(), tpgetunsol(), tpsubscribe(), tpsubscribe2(), tpunsubscribe(), tppost(), tpbroadcast(), tpgetcliaddr(), tpgetpeername(), tpgetsockname(), tpsleep(), tpgetactivesvr(), tpqsvcstat(), tpqstat(), tpenq(), tpdeq(), tpreissue(), tpmcall(), tpsvgcall(), tpenq_ctl(), tpdeq_ctl(), tx_begin() |
PB_TPCALL_RETRY |
Maximum number of allowable reattempts if a tpcall request fails due to a network error in the Power Builder environment. The following functions are affected by this variable. pb_tpcall(), pb_tpfcall(), pb_tpcallw(), pb_btpcall(), pb_etpcall(), tuxcall(), tuxfcall32(), tp_call(), tp_call32(), tp_fcall(), tp_fcall32() |
PB_TPCALL_RETRY_TIMEOUT |
BLOCKTIME per second for each request during a tpcall request in the Power Builder environment. For APIs which are affected by this environment variable, refer to the description about PB_TPCALL_RETRY. |
PB_TUXCOMPAT |
Provides compatibility with the Tuxedo library for using some of the APIs in the Power Builder environment. For detailed information, refer to Tmax Programming Guide(4GL). The following functions are affected by this variable. tuxcall(), tuxfcall32(), tp_call(), tp_call32(), pb_etpcall(), tp_fcall(), tp_fcall32() |
FDLVERSION |
FDL version. (Default value: 1) Setting to '2' uses the version with enhanced search performance and is not compatible with existing Tmax. This setting affects the scheduling of server applications and CLH that follows the ROUTING configuration. Configuration settings are not applied to clients, and the following environment variables must be configured. Set export FDLVERSION=2 or add "FDLVERSION=2" to the tmax.env environment file and then call tmaxreadenv(). When using fb* API, it returns the FBESETVER error if FDLVERSION setting does not match with its environment. |
TMAX_FDL_LONGSIGN |
Option to preserve the sign of a long-type value in FDL. (Default value: N) In FDL, the actual size of a long type is 4 bytes. When mapping a long value from C to FDL, differences in the expressible range between environments can cause incorrect value conversion. Only values within the 4-byte range are compatible; however, sign preservation is not guaranteed in some cases. For example, in a 32-bit environment, setting '-2' to a long variable and then storing the field value to a long variable in a 64-bit environment may result in a positive value instead of the original negative value. To preserve the original sign of long values within the 4-byte range, set this environment variable to 'Y'. [CAUTION] Due to compatibility limitations in heterogeneous systems, the maximum representable size for a long type in FDL is 4 byte integers. If a long value exceeds INT_MAX, its sign may not be preserved correctly during conversion. For example, the following issues may occur:
|
TMAX_PRB_1000 |
When the client is disconnected from CLH, ECONNRESET is checked, and a TPECLOSE occurs. If this option is set to 'Y', ECONNRESET is not checked, as in versions prior to Tmax 5 SP2 Fix#2, which may result in TPEOS on certain platforms. (Default value: N) |
TMAX_PRB_1002 |
When a function waiting for a response receives a signal, TPGOTSIG is returned immediately. If this option is set to Y, the function waits for the specified BLOCKTIME even if a signal is received, regardless of whether the TPSIGRSTRT flag is set. |
Set TMAX_SEMANTICS to use the encryption function. For encryption, the encryption function must set for both the client and server. The client encryption function can be set in .profile as in the following. For information about encryption setting of the server, refer to "CRYPT in DOMAIN".
<.profile>
export TMAX_SEMANTICS="CRYPT_SW=Y"
To use TMAX_SEMANTICS in tmaxreadenv, use a colon (:) instead of an equal sign (=) inside double quotes (").
<tmax.env>
TMAX_SEMANTICS="FDL_LEN:ERR" TMAX_SEMANTICS="CRYPT_SW:Y"
3. Setting Tmax Environment Variables
The following describes how to set server and client environment variables.
3.1. Server Environment Variables
Environment variables for Tmax system must be configured according to the shell type. The variables must be configured in <.profile> for korn shell, in <.bash_profile> for bash shell, and in <.cshrc> for c shell.
Make sure that there are no blank spaces between the name of the variable and the equal sign ('='). |
-
korn shell and bash shell
<.profile / .bash_profile>
export TMAXDIR=/home/tmax export TMAX_BKAPPDIR=/home/tmax/bkappbin export TMAX_HOST_ADDR=192.168.0.1 export TMAX_HOST_PORT=8888 export TMAX_RAC_PORT=3333 export SDLFILE=/home/tmax/sample/sdl/tmax.sdl export FDLFILE=/home/tmax/sample/sdl/tmax.fdl export TMAX_PATHDIR=/home/tmax/path_new export TMAX_DEBUG=/home/tmax/sample/client/clidebug
-
c shell
<.cshrc>
setenv TMAXDIR=/home/tmax setenv TMAX_BKAPPDIR=/home/tmax/bkappbin setenv TMAX_HOST_ADDR=192.168.0.1 setenv TMAX_HOST_PORT=8888 setenv TMAX_RAC_PORT=3333 setenv SDLFILE=/home/tmax/sample/sdl/tmax.sdl setenv FDLFILE=/home/tmax/sample/sdl/tmax.fdl setenv TMAX_PATHDIR=/home/tmax/path_new setenv TMAX_DEBUG=/home/tmax/sample/client/clidebug
Tmax is installed by executing install.sh, which will automatically add the basic environment variables at the end of the shell environment file. Environment variables required for server processes must be configured in a text file, and the file must be set in the ENVFILE section of the NODE and SVRGROUP sections in Tmax environment file.
<Server Environment File>
LOGDIR=/tmp USER_VARIABLE=test1 USER_VARIABLE=test2 USER_VARIABLE=test3 USER_VARIABLE=test4 USER_VARIABLE=test5
3.2. Client Environment Variables
The method for configuring the environment variables on client-only machines is different for each OS.
-
UNIX
Like server environment variables, variables are configured in the profile.
-
DOS or Windows98, Windows NT/2000
Environment variables are configured in the <autoexec.bat> or in the system profile of the control panel. ([Control panel] > [System properties] > [Advanced] > [Environment variables])
<autoexe.bat>
set TMAX_HOST_ADDR=192.168.0.1 set TMAX_HOST_PORT=8888 set TMAX_CONNECT_TIMEOUT=3 set SDLFILE=/home/tmax/sample/sdl/tmax.sdl set FDLFILE=/home/tmax/sample/sdl/tmax.fdl set TMAX_DEBUG=/home/tmax/sample/client/clidebug
Client environment variables must be defined in a text file, which the system will refer to.
<tmax.env>
[TEST] TMAX_HOST_ADDR=192.168.0.1 TMAX_HOST_PORT=8888 TMAX_CONNECT_TIMEOUT=3 SDLFILE=/home/tmax/sample/sdl/tmax.sdl FDLFILE=/home/tmax/sample/sdl/tmax.fdl ULOGPFX=/home/tmax/testlog TMAX_DEBUG=/home/tmax/sample/client/clidebug [REAL] TMAX_HOST_ADDR=192.168.0.2 TMAX_HOST_PORT=1234 TMAX_CONNECT_TIMEOUT=3 SDLFILE=/home/tmax/sample/sdl/tmax.sdl FDLFILE=/home/tmax/sample/sdl/tmax.fdl ULOGPFX=/home/tmax/reallog TMAX_DEBUG=/home/tmax/sample/client/clidebug
For more information about setting client environment variables, refer to tmaxreadenv in Tmax Reference Guide. |
4. Registering Multiple Servers
In the previous versions of Tmax, each client could only connect to one specific server, but versions 3.12.2 and later include load balancing feature to randomly connect each client to a server. To use multiple servers, configure the TMAX_HOST_ADDR setting.
To enable this function, the following must be set in the configuration file.
-
IPv4
TMAX_HOST_ADDR=(host_address:portno|host_address2:portno2), host_address3:portno3,host_address4:portno4
-
IPv6
TMAX_HOST_ADDR=([host_address]:portno|[host_address2]:portno2), [host_address3]:portno3,[host_address4]:portno4
Backup addresses for the client to connect to are separated by a comma. In the previous example, the client will first attempt to connect to "host_address:portno|host_address2:portno2". If the connection attempt fails, the client will try to connect to "host_address3:portno3". If the second attempt also fails, then the client will try to connect to "host_address4:portno4".
The addresses in parenthesis separated by a pipe(|) have a load balancing relationship with one another. This means that a client will randomly attempt to connect to one of these addresses, and in case of a connection failure, the client will sequentially attempt to connect to those in the load balancing relationship. If all fails, it will then try to connect to the backup addresses.
The following is the description of TMAX_HOST_ADDR.
-
Maximum length is 255 bytes.
-
In the event that all attempts to connect to the addresses in TMAX_HOST_ADDR fail, the client will then attempt to connect to the addresses specified by TMAX_BACKUP_ADDR.
-
No spaces should be used for TMAX_HOST_ADDR value.
-
Double quotation marks(" ") must be used when specifying environment variables with export or setenv in the shell, because the shell interprets parentheses and pipe character differently than other characters.
Examples
The following example compares server configuration methods.
-
Connecting the client by using existing settings
TMAX_HOST_ADDR=192.1.1.1 TMAX_HOST_PORT=9000
-
Enabling load balancing that randomly connects the client to one of multiple addresses:
TMAX_HOST_ADDR=(192.1.1.1:9000|192.1.1.2:9001),192.1.1.3:9003,192.1.1.4:9004
-
Randomly connecting the client to an address (IPv6 protocol environment)
In an IPv6 protocol environment, addresses are placed inside square brackets([ ]) to distinguish a host address from a portno.
TMAX_HOST_ADDR=([2011::10]:9000|[2011::20]:9001),[2011::100:30]:9003,[2011::100:40]:9004