Defining Environment Variables

GT.M requires the definition of certain environment variables as part of setting up the environment. These environment variables are used for the following purposes:

The procedure below describes how to define an environment variable. Use this procedure to define an environment variable either at the shell prompt or in your shell startup file. If you define the variable at the shell prompt, it will be effective only until you logout. If you define it in your .profile file (.cshrc, if using a C shell variant), it will be in effect whenever you log in. Your system manager may have already defined some of these variables.

[Note] Note

Each environment variable required by GT.M is described and illustrated in individual sections following the procedure. Only gtm_dist, and in some cases gtmgbldir, gtm_principal and gtmroutines, are required by users who do not perform programming activities.

To define an environment variable type the following commands:

$ env_variable=env_variable_value
$ export env_variable

The following environment variables hold information that determines some details of GT.M run-time operation, over which the user has control.


gtm_dist is used to establish the location of the installed GT.M program and support files.

The syntax for gtm_dist is as follows:

$ gtm_dist=<GT.M-distribution-directory>

The standard installation places these files in /usr/lib/fis-gtm.


$ gtm_dist=/usr/lib/fis-gtm/V6.0-002_x86_64
$ export gtm_dist

This identifies /usr/lib/fis-gtm/V6.0-002_x86_64 as the location of the installed GT.M files.

Add gtm_dist to your PATH environment variable to have UNIX search the GT.M installation directory (when processing a command to activate or run an image). This allows you to activate GT.M and the utilities without explicitly specifying a path.

To add gtm_dist to your PATH type the following commands:

$ PATH=$PATH:$gtm_dist
$ export PATH
[Note] Note

Most of the examples in this manual assume that you have added gtm_dist to your PATH.


gtmgbldir defines the path to a Global Directory. A Global Directory maps global variables to physical database files, and is required to locate M global variables. gtmgbldir provides the initial value for $ZGBLDIR, the intrinsic special variable that connects the GT.M run-time system to the Global Directory. It also connects the Global Directory to the utilities requiring one.

If you maintain multiple global directories, define gtmgbldir to the Global Directory you currently want to use.

The syntax of a gtmgbldir definition is:

$ gtmgbldir=/directory/filename.gld


$ gtmgbldir=/usr/staff/mumps.gld
$ export gtmgbldir

This specifies /usr/staff as the directory containing the Global Directory file named mumps.gld.


The gtm_principal environment variable specifies the value for $principal, which designates the absolute pathname of the principal $IO device. This is an MDC Type A enhancement to standard M.

The following is an example of gtm_principal definition:

$ gtm_principal=/usr/filename
$ export gtm_principal

This specifies the /usr/filename as the principal $IO device, effective until changed further or until you logout of the particular session.


The gtmroutines environment variable specifies a search list of possible locations for M routines. This value is used to initialize $ZROUTINES, (the intrinsic special variable that enables GT.M to find the routine (program) you want to run). gtmroutines is required for ZLINKing. gtmroutines is particularly helpful in calling percent utilities and the Global Directory Editor (GDE), which are in gtm_dist.

$ gtmroutines="directories in search list"

The directories in the search list must be separated by a space and enclosed in quotation marks (" "). Environment variables are accepted in the search list.

The following is an example of gtmroutines definition:

$ gtmroutines=". $gtm_dist"
$ export gtmroutines

This specifies that GT.M search for a routine first in the current directory (.), then in the distribution directory (which is identified by the environment variable gtm_dist). The distribution directory is included in the list because it contains the percent routines. You will probably want the search list to contain these two items at a minimum. In addition, you may want to add directories of your own.

For additional information about how GT.M uses the routine search list, see “$ZROutines”.


The EDITOR environment variable specifies the UNIX text editor used when editing a routine either from the shell or with ZEDIT. Since this is a standard part of establishing your UNIX environment, you will probably only need to define this when you want to use a different editor than the one defined in your shell startup file.


$ EDITOR=/usr/bin/vi
$ export EDITOR

This defines the current text editor to vi.