$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 logical name GTM$GBLDIR. If GTM$GBLDIR is not defined, GTM initializes $ZGBLDIR to null. When $ZGBLDIR is null, GT.M constructs a file-specification for the Global Directory using the name GTM$GBLDIR and the extension .GLD in the process current default directory. A $ZGBLDIR value has the form of an RMS file-specification, which may include a logical name. GT.M handles logical names that translate to other logical names by performing iterative translations according to VMS conventions. If a logical name translates to a VMS search list, GT.M uses only the first name in the list.

$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 GTM$GBLDIR, if that logical name is defined. If GTM$GBLDIR is not defined, then SET $ZGBLDIR="" causes GT.M to assign the string "GTM$GBLDIR" to $ZGBLDIR. This specifies the file GTM$GBLDIR.GLD in the current directory. GT.M permits $ZGBLDIR to be NEW'd.

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 DCL DEFINE command to assign a translation to GTM$GBLDIR. Defining GTM$GBLDIR provides a convenient way to use the same Global Directory during a session where you repeatedly invoke and leave GT.M.

Frequently, a system manager provides a default definition of GTM$GBLDIR in the system logical name table or in the login command files. You can override such a definition by (re)defining GTM$GBLDIR in your process logical name table.

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

Example:

    $ DEFINE GTM$GBLDIR TEST.GLD
    $ GTM
    GTM> WRITE $ZGBLDIR
    TEST.GLD
    GTM> SET $ZGBLDIR="MUMPS.GLD"
    GTM> WRITE $ZGBLDIR
    MUMPS.GLD
    GTM> HALT
    $ SHOW LOGICAL GTM$GBLDIR
    TEST.GLD   
    

This defines the logical name, GTM$GBLDIR. In GT.M Direct Mode, $ZGBLDIR has the value supplied by GTM$GBLDIR. The SET command changes the value. After the GT.M image terminates, the DCL command SHOW LOGICAL demonstrates that GTM$GBLDIR was not modified by the M SET command.

    $ 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.

Example:

    $ DIR TEST.GLD
    %DIRECT-W-NOFILES, no files found
    $ GTM
    GTM> WRITE $ZGBLDIR
    MUMPS.GLD
    GTM> SET $ZGBLDIR="TEST.GLD"
    %GTM-E-ZGBLDIRACC, Cannot access global
    directory "TEST.GLD". Continuing with "MUMPS.GLD
    %RMS-E-FNF, file not found
    GTM> WRITE $ZGBLDIR
    MUMPS.GLD
    GTM> HALT
    $
    

The SET command attempts to change the value of $ZGBLDIR to TEST.GLD, but because the file does not exist, GT.M reports an error and does not change the value of $ZGBLDIR.

[Caution]

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