Running a Program


Under OpenVMS, programs have the filetype .EXE. How you run them depends on the expectations of the program. Some programs are part of OpenVMS, and these generally execute automatically in response to the appropriate DCL command. Other programs, such as those you may create yourself with a language compiler or third-party software, may be invoked in different ways.

Other than normal DCL commands that execute standard system programs, there are three main ways to run a program under OpenVMS. They are the RUN command, foreign commands, and custom DCL verbs created by the command definition utility (CDU).

The RUN Command

The DCL RUN command is usually used to execute a program that does not need command line arguments. Its format is as follows:

    $ RUN program_filespec 

To execute the program COLLECT.EXE in the current directory, use this command:

    $ RUN COLLECT 

Note

The RUN command may also be used to start a program running as a detached process (RUN/DETACH). Creating and running such programs is not covered in this book.

Foreign Commands

Native OpenVMS programs often make use of the extensive command line processing capabilities in DCL. However, some programs are written to process their own command lines, such as programs ported from UNIX or some other operating system. For these, a foreign command is usually used.

A foreign command is a special DCL symbol that runs a program and passes the command line directly to the program. Foreign commands may also be used with many programs that do not require command line arguments as an alternative to the RUN command.

Say your program TALLY.EXE should process its own command line. You would create a foreign symbol TALLY as follows:

    $ TALLY :== $DKB400:[ALICE]TALLY 

The dollar sign ($) just before the program's file specification is what indicates a foreign command. If you omit the disk and directory, the directory SYS$SYSTEM will be assumed.

Using the symbol TALLY as a command verb will invoke TALLY.EXE and pass the rest of the command line to it. The format of the command line parameters and switches (qualifiers) depends entirely on what TALLY.EXE expects; DCL simply passes the command line to the program. Thus, a program ported from UNIX might have a command line that looks something like this:

    $ TALLY +iFILE1.DAT +oFILE2.DAT +v+x 

The above command line will be passed to the program intact, leaving TALLY.EXE to process parameters and switches on its own.

DCL Paths

Later versions of OpenVMS include a way to automatically support foreign commands for executable files residing in a set of directories you define.

Ordinarily, when you enter a command verb that does not match a DCL command, you would receive an error message. With DCL paths, directories of your choice will first be searched for programs with that name. If a matching program is found, it will be invoked as a foreign command.

To define a path search list, define the logical name DCL$PATH, specifying a directory or list of directories to be searched:

    $ DEFINE DCL$PATH DKA100:[MIKE] 

or

    $ DEFINE DCL$PATH DKA100:[MIKE.TOOLS],DKA0:[UTILITIES] 

Note

logical names are described further on in this chapter.

Let's say that a program DKA0:[UTILITIES]ENCRYPT.EXE exists. Once the DCL path has been defined, you can use ENCRYPT as a command verb, and DCL will automatically locate the program and invoke it as a foreign command.

Custom DCL Commands

When a programmer writes a program specifically designed for OpenVMS, the programmer may elect to take advantage of the extensive command line capabilities of DCL using the OpenVMS CDU. Using this feature, new DCL verbs, along with qualifiers, keywords, and parameters can be created.

Digital, Compaq, and Hewlett-Packard software products, third-party software products, or programs developed by end users may use this feature. Many sites include these custom commands in the system wide DCL command tables, making them available to all users. In fact, you may never become aware that some of the commands you use on a daily basis may have been added to your system in just this way.

Your system manager may notify you about any custom commands available to you, as well as any additional steps you must take to use them.[1]

[1]The material in Appendix A is drawn from Chapter 7 of Michael D. Duffy, Getting Started with OpenVMS: A Guide for New Users, 1-55558-279-6, 2002, Elsevier Science (USA).




Getting Started with OpenVMS System Management
Getting Started with OpenVMS System Management (HP Technologies)
ISBN: 1555582818
EAN: 2147483647
Year: 2004
Pages: 130
Authors: David Miller

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net