$ZDirectory

$ZD[IRECTORY] contains the string value of the full path of the current directory. Initially $ZDIRECTORY contains the default/current directory from which the GT.M image/process was activated.

GT.M supports different forms for the intrinsic special variable $ZDIRECTORY. The symbol GTM$ZDIR_FORM in GTM$DEFAULTS controls the form of $ZDIRECTORY. By default, $ZDIRECTORY contains the full path of the default directory, including the device and directory specification. The default form corresponds to GTM$ZDIR_FORM holding the value zero (0). The other possible value for GTM$ZDIR_FORM is one (1). This value causes $ZDIRECTORY to contain only the directory specification, excluding the device specification.

If the application would like to use the non-default form of $ZDIRECTORY, one can modify the value for GTM$ZDIR_FORM in GTM$DEFAULTS appropriately before creating a linked image of the application.

Example:

    GTM>WRITE $ZDIR
    DISK$USER11:[PROD.AP.ROUTINES]
    GTM>SET $ZDIR="[-]"
    GTM>WRITE $ZDIR
    DISK$USER11:[PROD.AP]    
    

This example displays the current default directory in the default form of ZDIRECTORY which includes both the device and the directory specification. It also changes $ZDIRECTORY to point to the parent directory.

$ZDIRECTORY is a read-write Intrinsic Special Variable, that is, it can appear on the left side of the equal sign (=) in the argument to a SET command. If an attempt is made to set $ZDIRECTORY to a non-existent directory specification, GT.M issues an error and keeps the value of $ZDIRECTORY unchanged.

At image exit, GT.M restores the working directory to the directory that was the default when GT.M was invoked. The only exception to this is in case the directory does not exist and GT.M had successfully modified its default directory using SET $ZDIR at least once. In such cases, the default directory at image exit is the last directory to which GT.M successfully changed its default directory using SET $ZDIR.