$ZGbldir

$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, (that is, 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. NEWing $ZGBLDIR is the same as SET $ZGBLDIR="", which as just noted may change its value. For code that immediately SETs $ZGBLDIR after NEW'ng it that behavior doesn't matter, but without an associated SET, such a change may seem counterintuitive. 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.

Example:

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

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
/usr/dev/mumps.gld
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
/usr/dev/mumps.gld
GTM>halt
$

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.