Introduction

This chapter explains the procedures to setup GT.M for normal use and perform basic system management operations. It is designed to get users started quickly, and provides the basic information required to run and stop GT.M efficiently.

Most of the examples in this chapter assume that users have added gtm_dist to the system environment variable PATH , as described in “Defining the Environment Variables” in the following text.

Before Starting GT.M

Before starting GT.M at any time:

  • The gtm_dist environmental variable must be defined.

  • Fidelity strongly recommends the definition of the gtm_log, gtmgbldir, and gtmroutines environmental variables.

Defining the Environment Variables

The four environment variables GT.M used for normal operation are:

  • gtm_dist

  • gtm_log

  • gtmgbldir

  • gtmroutines

Note: The required gtm_dist environment variable specifies the path to the directory containing the GT.M system distribution. Although gtm_log, gtmgbldir, and gtmroutines are not required for GT.M to operate, Fidelity recommends defining these variables. The variables help ensure that intended database files are accessed and intended directories used for the creation of files generated by GT.M.

See “Configuring and operating GT.M with Unicode™ support (optional)” for more information on defining all environment variables required for Unicode™-related operations of GT.M.

gtm_dist

The gtm_dist environment variable specifies the path to the directory containing the GT.M system distribution. gtm_dist must be defined for each user. Users may want to define gtm_dist in the login file, or as part of the default system environment.

You can define gtm_dist as follows:

$ gtm_dist=<distribution directory>
$ export gtm_dist

For example, if the GT.M distribution is in /usr/local/gtm, enter:

$ gtm_dist=/usr/local/gtm

gtm_dist is used to establish communications with the GT.M gtmsecshr daemon and for the location of GT.M components.

Add $gtm_dist to the system environment variable PATH as follows:

$ PATH=$PATH:$gtm_dist
$ export PATH

gtm_log

The gtm_log environmental variable specifies a directory where the gtm_secshr_log file is stored. The gtm_secshr_log file stores information gathered in the gtmsecshr process. Fidelity recommends that a system-wide default be established for gtm_log so that gtmsecshr always logs its information in the same directory, regardless of which user's GT.M process invokes gtmsecshr.

gtmgbldir

The gtmgbldir environment variable identifies the global directory to be used. A global directory maps global variables to physical database files, and is required to access M global variables. Users who maintain multiple global directories must choose one to use. To automate this definition, define gtmgbldir in the user's login file.

The following is an example of a gtmgbldir definition:

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

gtmroutines

The gtmroutines environment variable specifies a directory search list of possible locations for M routines. This search enables GT.M to find the routine (program) that a user wants to run even if it is not in the current working directory. Fidelity Information Services recommends the inclusion of $gtm_dist in the list of directories specified in gtmroutines permits access to the Global Directory Editor (GDE) and to utility routines supplied with GT.M.

The following is an example of a gtmroutines definition, assuming that $ gtm_dist has been defined:

$ gtmroutines=". $gtm_dist"
$ export gtmroutines

This specifies that GT.M first search for a routine in the current directory, then in the distribution directory (included in the list because it contains the percent routines). Users may want the search list to contain these at a minimum; in addition, to including other directories. See "$ZROUTINES" section of the "Intrinsic Special Variables" chapter in the GT.M Programmer's Guide for details on gtmroutines syntax.

TERM

Users must set the environment variable TERM to a terminfo entry that accurately matches the terminal (or terminal emulator) settings. Refer to the terminfo man pages for more information on the terminal settings of the platform where GT.M needs to run.

Some terminfo entries may seem to work properly but fail to recognize function key sequences or position the cursor properly in response to escape sequences from GT.M. GT.M itself does not have any knowledge of specific terminal control characteristics. Therefore, it is important to specify the right terminfo entry to let GT.M communicate correctly with the terminal. Users may need to add new terminfo entries depending on their specific platform and implementation. The terminal (emulator) vendor may also be able to help.

GT.M uses the following terminfo capabilities. The full variable name is followed by the capname in parenthesis.

auto_right_margin(am), clr_eos(ed), clr_eol(el), columns(cols), \
cursor_address(cup), cursor_down(cud1), cursor_left(cub1), \
cursor_right(cuf1), cursor_up(cuu1), eat_newline_glitch(xenl), \
key_backspace(kbs), key_dc(kdch1), key_down(kcud1), key_left(kcub1), \
key_right(kcuf1), key_up(kcuu1), key_insert(kich1), keypad_local(rmkx), \
keypad_xmit(smkx), lines(lines).

GT.M sends keypad_xmit before terminal reads for direct mode and READs (other than READ *) if EDITING is enabled. GT.M sends keypad_local after these terminal reads.

Configuring and operating GT.M with Unicode™ support (optional)

Users have the option to install GT.M with or without Unicode-related functionality. This section describes the system environment required to install and operate GT.M with Unicode-related functionality. Users who handle data in ASCII character set (based on English alphabets and numbers) and do not foresee any use of Unicode™ character sets (designed to accommodate all writing systems of the world) may proceed to the next section.

Compiling ICU 3.6

GT.M uses ICU 3.6 to perform Unicode™-related operations. GT.M generates the distribution for Unicode only if ICU 3.6 (or above) is installed on the system. Therefore, install an appropriate ICU version before installing GT.M to perform functionality related to Unicode™. Note that the ICU installation instructions may not be the same for every platform.

Define the environment variables

This section describes all environment variables that a user must define to operate GT.M with Unicode support.

gtm_chset

The environment variable gtm_chset determines the mode in which GT.M operates. If it has a value of "UTF-8", then GT.M (at process startup) interprets strings encoded in UTF-8 character set.

If it has a value of "M", then GT.M interprets string as being composed of 256 combinations of the 8 bits in a byte as a character, that is, the ASCII character set.

Note: See “GT.M Operations - M mode and UTF-8 mode” for more information on operating GT.M for ASCII and non-ASCII character sets.

gtm_dist

The gtm_dist environment variable specifies the path to the directory containing the GT.M system distribution for Unicode. The distribution for Unicode is located in subdirectory utf8 under the GT.M distribution directory.

For example, if the GT.M distribution is in /usr/local/gtm, enter:

$ gtm_dist=/usr/local/gtm/utf8 ; 
$ export gtm_dist

Add $gtm_dist to the system environment variable PATH as follows:

$ PATH=$PATH:$gtm_dist
$ export PATH

gtm_dist is used to establish communications with the GT.M gtmsecshr daemon and for the location of GT.M components.

[Important]

GT.M generates the distribution for Unicode only if ICU 3.6 (or above) is installed on the system. Therefore, installing ICU is a prerequisite for GT.M to perform functionality related to Unicode.

gtmroutines

The gtmroutines environment variable specifies a directory search list of possible locations for M routines and UTF-8 routines. This search enables GT.M to find the routine (program) that a user may want to run even if it is not in the current working directory.

The following is an example of a gtmroutines definition, assuming that $ gtm_dist has been defined and is set to /usr/local/gtm/utf8:

$ gtmroutines=". $gtm_dist `echo $gtm_dist | sed 's/utf8\(\/\)*//'`"
$ export gtmroutines
echo $gtmroutines 
. usr/local/gtm/utf8 /usr/local/gtm/ 

This specifies that GT.M first search for a routine in the current directory, then in the Unicode distribution directory (included in the list because it contains the utf8 routines) and then in the GT.M main distribution directory. Users can include other directory as well with space as the delimiter. See the "$ZROUTINES" section of the "Intrinsic Special Variables" chapter in the GT.M Programmer's Guide for details on gtmroutines.

LC_CTYPE

Use the environment variable LC_CTYPE to select a locale with UTF-8 support. For example, zh_CN.utf8.

LC_ALL

Use the environment variable LC_ALL to select a locale with UTF-8 support. LC_ALL is an alternative to LC_TYPE, which overrides LC_TYPE and has a more pervasive effect on other aspects of the environment beyond GT.M.

LD_LIBRARY_PATH

Use the environment variable LD_LIBRARY_PATH (or LIBPATH in AIX) to point to the location of ICU. GT.M requires ICU 3.6 to perform Unicode related functionality. Note that the ICU installation instructions may not be the same for every platform.

GT.M Operations - M mode and UTF-8 mode

GT.M operates in two mode - M mode and UTF-8 mode. Users can use either M mode or UTF-8 mode depending on the character set of the underlying data. Users must set GT.M to:

  • M mode when the application relies on a one-to-one correspondence between bytes and characters. In this mode, GT.M treats all 256 combinations of the 8 bits in a byte as a character, which is suitable for example to many ISO character-sets.

  • UTF-8 mode while accessing Unicode characters from the database. In UTF8 mode, all functionality related to Unicode™ becomes available and standard string-oriented operations (particularly intrinsic functions) operate with UTF-8 encoding. In UTF8 mode, GT.M detects character boundaries (especially when the size of a character is greater than 1 byte), calculates glyph display width, and performs string conversion between UTF-8 and UTF-16.

The following is a sample command sequence to change the system environment from M mode to UTF-8 mode. Assume that $ gtm_dist has been defined and is set to /usr/local/gtm:

gtmroutines=". $gtm_dist/utf8 $gtm_dist"
export gtmroutines
gtm_dist=$gtm_dist/utf8
export $gtm_dist
$gtm_chset="UTF-8"
$export gtm_chset 

The following is a sample command sequence to change the system environment from UTF-8 mode to M mode. Assume that $ gtm_dist has been defined and is set to /usr/local/gtm/utf8:

$gtm_dist=`echo $gtm_dist | sed 's/utf8\(\/\)*//'`"
$ export gtm_dist
$ gtmroutines=". $gtm_dist" 
$ export gtmroutines 
$ gtm_chset="M"

Providing Access to GT.M

This section explains three procedures to set up the GT.M environment variables and include GT.M in the default system path for a specific user to run GT.M for normal operations. Select any one procedure based on the that user's shell and personal preference:

Procedure 1

Execute the script gtmbase from that user's directory. Specify the complete path to the directory in which GT.M was installed:

$ /<gtm_dist pathname>/gtmbase

This script adds GT.M to that user's system path, defines GT.M environment variables required for normal use, and accordingly updates that user's login file (.profile file for Bourne shell or .cshrc for the C shell). The script defines the GTM environment variables as follows:

  • gtm

  • gtm_dist

  • gtmgbldir

  • gtmroutines

  • gde

  • lke

  • dse

Now that user can run GT.M and its utilities without specifying a full path to the directory in which GT.M was installed.

Procedure 2

Add following line to .profile or .cshrc file depending on the shell of that user.

In the Bourne shell add the following line to .profile:

<gtm_dist pathname>/gtmprofile 

In the C shell, add the followign line to .cshrc:

source <gtm_dist pathname>/gtmcshrc

In both cases, specify the required full path name to the directory where GT.M was installed.

This creates the GT.M environment variables (See Procedure 1 for the list of environment variables) and updates that user's system path to include the directory where GT.M is installed.

Procedure 3

Define all the environment variables and aliases in the .profile file of that user. Production application users generally need commonly used commands in their .profile file as well.

Add the following files to that user's .profile file. Replace <dist dir area> with the directory in which GT.M is installed and <global directory path and file name> with the location of the global directory.

gtmgbldir=mumps.gld
export gtmgbldir          
gtm_dist=<gtm_dist pathname>
export gtm_dist
gtmroutines=". $gtm_dist"
export gtmroutines
gtmgbldir=<global directory path and file name>
export gtmgbldir
PATH=$PATH:$gtm_dist
export PATH

Running GT.M

GT.M has three modes: compiler, direct, and auto-start. Invoke these modes by using the mumps command issued with an appropriate argument.

  • To operate in compiler mode, invoke GT.M by entering the mumps command with a list of file names to compile. GT.M then compiles the specified programs into .o files. UNIX wildcards (* and ?) are acceptable within the file names.

  • To operate in direct mode, invoke GT.M by entering the mumps command with the -direct argument. GT.M then enters direct mode, where one can enter M commands interactively.

  • To operate in auto-start mode, invoke GT.M by entering the mumps command with the -run argument. The next argument is taken to be an M entryref, and that routine is automatically executed, bypassing direct mode. Depending on the shell being used, one may need to put the entryref in quotes.

When executing M programs, GT.M incrementally links any called programs. For example, the command

GTM> d ^TEST

links the object file TEST.o and executes it; if the TEST program calls other M routines, those are automatically compiled and linked.