$ZG[BLDIR] contains the value of the current Global Directory filename. When $ZGBLDIR specifies an invalid or inaccessible file, GT.M cannot successfully perform database operations.

GT.M initializes $ZGBLDIR to the translation of the environment variable gtmgbldir. The value of the gtmgbldir environment variable may include a reference to another environment variable. If gtmgbldir is not defined, GT.M initializes $ZGBLDIR to null. When $ZGBLDIR is null, GT.M constructs a file name for the Global Directory using the name $gtmgbldir and the extension .gld in the current working directory.

$ZGBLDIR is a read-write Intrinsic Special Variable, (i.e., it can appear on the left side of the equal sign (=) in the argument to the SET command). SET $ZGBLDIR="" causes GT.M to assign $ZGBLDIR to the translation of gtmgbldir if that environment variable is defined. If it is not defined, then SET $ZGBLDIR="" causes GT.M to construct a file name using the name $gtmgbldir.gld in the current directory. GT.M permits $ZGBLDIR to be NEW'd. A $ZGBLDIR value may include an environment variable.

SETting $ZGBLDIR also causes GT.M to attempt to open the specified file. If the file name is invalid or the file is inaccessible, GT.M triggers an error without changing the value of $ZGBLDIR.

To establish a value for $ZGBLDIR outside of M, use the appropriate shell command to assign a translation to gtmgbldir. Defining gtmgbldir provides a convenient way to use the same Global Directory during a session where you repeatedly invoke and leave GT.M.

Changes to the value of $ZGBLDIR during a GT.M invocation only last for the current invocation and do not change the value of gtmgbldir.


$ gtmgbldir=test.gld
$ export gtmgbldir
$ gtm
GTM>WRITE $zgbldir
GTM>SET $zgbldir="mumps.gld"
GTM>WRITE $zgbldir
$ echo $gtmgbldir

This example defines the environment variable gtmgbldir. Upon entering GT.M Direct Mode, $ZGBLDIR has the value supplied by gtmgbldir. The SET command changes the value. After the GT.M image terminates, the echo command demonstrates that gtmgbldir was not modified by the M SET command.

$ ls test.gld
test.gld not found
$ gtm
GTM>WRITE $zgbldir
GTM>set $zgbldir="test.gld"
%GTM-E-ZGBLDIRACC, Cannot access global directory
"/usr/dev/test.gld". Retaining /usr/dev/mumps.gld"
%SYSTEM-E-ENO2, No such file or directory
GTM>WRITE $zgbldir

The SET command attempts to change the value of $ZGBLDIR to test.gld. Because the file does not exist, GT.M reports an error and does not change the value of $ZGBLDIR.

[Caution] Caution

Attempting to restore an inaccessible initial Global Directory that has been NEW'd, can cause an error.