$Principal

$P[RINCIPAL] contains the name of the principal (initial $IO) device. GT.M establishes $PRINCIPAL as a fully expanded VMS device specification. $PRINCIPAL is an MDC Type A enhancement to standard M.

Input and output for a process may come from separate devices. VMS designates these devices with the process-permanent logical names SYS$INPUT and SYS$OUTPUT.. However, the M I/O model allows only one device to be USEd (or active) at a time. When an image starts, GT.M implicitly OPENs the devices(s) identified by SYS$INPUT and SYS$OUTPUT and assigns the device(s) to $PRINCIPAL. For USE deviceparameters, it is the standard input that determines the device type.

For an image invoked interactively, $PRINCIPAL is the user's terminal. For a batch job, $PRINCIPAL is the command file for input and the log file for output. For an image invoked from a terminal by means of a command file, $PRINCIPAL is the command file for input and the terminal for output, unless the command file redefines the logical names SYS$INPUT and/or SYS$OUTPUT. Generally an interactive command file contains the following command immediately before it starts a GT.M image.

Example:

    $ DEFINE SYS$INPUT 'F$TRNLNM("SYS$COMMAND")'        
    

This redirects the input for the process to come from the terminal.

GT.M provides a mechanism for the user to create a name for $PRINCIPAL in DCL before invoking GT.M. The logical GTM$PRINCIPAL, if defined becomes a synonym for the actual device and the value for $PRINCIPAL. $IO holds the same value as $PRINCIPAL. $ZIO in this case, holds the fully expanded name of the actual device. Refer to $ZIO section in this chapter for an example of its usage.

GT.M ignores a CLOSE specifying the principal device. GT.M does not permit the SET command to modify $PRINCIPAL.