Chapter 9: Command Procedures

Overview

Command procedures are text files containing DCL commands that DCL executes sequentially. Much like a program, command procedures provide for branching, subroutines, comparisons, and variables (in the form of symbols).

Command procedures may be executed directly by an interactive user, or they may be submitted to a batch queue for execution at a specified time.

    $ !    $ ! EXAMPLE1.COM, an example command procedure.    $ !    $ show time       ! Display the system time    $ wait 00:00:10   ! Wait for 10 seconds    $ show time       ! Display the time again    $ exit            ! And we're done. 

This procedure, called EXAMPLE1.COM, displays the current time, waits 10 seconds, and then displays the time again. When executed, this procedure produces output like the following:

     $ @EXAMPLE1       29-OCT-2002 17:15:42       29-OCT-2002 17:15:52 

Note that only messages generated by the commands are shown. To cause each line of your procedure to be echoed (displayed) as it is executed, place the SET VERIFY command in your procedure or issue the SET VERIFY command at your terminal before executing the procedure. Use SET NOVERIFY to suppress it.

     $ SET VERIFY     $ @EXAMPLE1     $ !     $ ! EXAMPLE1.COM, an example command procedure.     $ !     $ show time       ! Display the system time       29-OCT-2002 17:15:42     $ wait 00:00:10   ! Wait for 10 seconds     $ show time       ! Display the time again       29-OCT-2002 17:15:52     $ exit            ! And we're done. 

The first example of a command procedure most users will see is their personal LOGIN.COM procedure. As discussed earlier, each user has her own LOGIN.COM that is executed automatically at each login. LOGIN.COM can perform almost any function, but most users use it to adjust the OpenVMS environment to their own personal preferences. Such customizations include setting terminal characteristics, defining symbols for common commands, and so on.

Command procedures can range from the very simple to the very complex. One procedure might have two or three commands that define symbols, whereas another might be several hundred lines in length and perform complex software builds. Even the simplest command procedures can save time by grouping frequently used sequences of commands together.

Command procedures allow the use of flow-control commands, such as GOTO, GOSUB/RETURN, and CALL, allowing you to create a command procedure that has many of the features of a compiled program. These commands allow the execution of different parts of the procedure in response to conditions you specify.

The following sections will show you how to create and use command procedures, both interactively from your terminal and as batch processes.



Getting Started with OpenVMS(c) A Guide for New Users
Getting Started with OpenVMS: A Guide for New Users (HP Technologies)
ISBN: 1555582796
EAN: 2147483647
Year: 2005
Pages: 215

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