Executing from DCL

An M application packaged as an executable image can execute in three modes: Interactive, Batch and Detached. The DCL RUN command starts all three modes of execution.

At the DCL prompt you can issue a RUN command with a parameter specifying an executable image linked with the VMS LINK utility.

        $ RUN PAYROLL
      

When the command is part of a DCL command procedure invoked by an interactive process, the procedure usually must precede the RUN with a command to redirect I/O back to the terminal during GT.M execution.

Example:

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

The DEFINE command redirects input from the command procedure file to the terminal for the duration of PAYROLL's execution.

The DCL SUBMIT command delivers procedures to the VMS batch processing system. These command procedures may contain RUN commands invoking GT.M executable images. When using batch, the command procedure may include imbedded input for GT.M.

Example:

        $ CREATE BAT.COM
        $ MUMPS/DIRECT
        READ X
        This becomes X and then output.
        WRITE X,!
        HALT
        $ EXIT
        <CTRL Z>
        $ SUBMIT/NOTIFY/NOPRINT BAT
        $
      

This CREATEs a simple command file to demonstrate input and output in batch. The system directs the output to a file-specification constructed from the name of the input file in SYS$LOGIN for the process with an extension of .LOG. Normally the image would be invoked by RUNning an application image rather than invoking Direct Mode with the MUMPS/DIRECT command.

Alternatively a batch application may manage its own I/O with M OPEN, USE and CLOSE commands. For more information, refer to the "Input/Output Processing" chapter in this manual.

The /DETACHED qualifier on the RUN command causes VMS to create a new job that is neither interactive nor batch. When a detached job performs input or output, the RUN /DETACHED command may include the /INPUT= and /OUTPUT= qualifiers. Alternatively a detached application may manage its own I/O with M OPEN, USE and CLOSE commands.

Example:

        $ RUN/DETACHED PAYROLL/INPUT=SYS$LOGIN:DRIVER.DAT/OUTPUT=RESULTS.DAT
      

This creates a detached job to perform the PAYROLL application and specifies files for both input and output.

GT.M handles errors in the same fashion, regardless of how the image is invoked. For more information, refer to the "Error Processing" chapter in this manual. If an image makes no provision providing explicit error handling, GT.M places the process in Direct Mode. If the process is interactive, this permits immediate access to the GT.M debugging environment. For more information, refer to the "Operating and Debugging in Direct Mode" chapter in this manual.

If the process is batch or detached, generally GT.M does not find appropriate Direct Mode input and (eventually) terminates the image. When either SYS$ERROR or SYS$OUTPUT are files that are retained or printed, you can examine the error reports and initiate an appropriate action such as rerunning in interactive mode or entering an edit, compile, link and run cycle.

When an executable image terminates, it releases control back to the DCL that invoked it and execution continues in the original mode unless the end of the input indicates that VMS should terminate the process.