Chapter 2 -- DCL Commands


This chapter covers the basics of DCL (Digital Command Language). DCL is the normal Command Language Interface for OpenVMS. This chapter is broken up into the following sections:

2.1 Entering DCL Commands

DCL commands consist of verbs, parameters, and qualifiers. The verb describes the program to run (the "action"), the parameters usually refer to the objects to be affected, and the qualifiers serve to modify the verb and parameters. The general format of a DCL command is:
$ [label:] verb [/qualifiers] [parameters] [/qualifiers] 

The dollar sign ($) is the default DCL prompt; it will appear whenever DCL is ready to process a command. In the following examples, you don't need to type the $ as part of the command.

The notation [] indicates optional command components. Labels are used in conjunction with command procedures, which are described later in this guide.

DCL is, by default, case-insensitive since it converts text to uppercase before parsing it. Commands can appear in uppercase, lowercase, or mixed-case. For example, the following commands are all equivalent:

$ EDIT TEST.TXT
$ edit test.txt
$ EdIt TeSt.TxT

Verbs and parameters are separated by whitespace, which can be any number of tabs or spaces.

The double-quote character (") is used to override uppercase translation. Text that appears in double quotes is not translated to uppercase and is treated as one syntactic unit. This means that it is possible to specify values that use mixed case and have multiple words. The following commands demonstrate uses of the double-quote character:

$ SEARCH TEST.TXT "Mixed-case words"
$ SET PROCESS/NAME="Process name"

DCL command verbs can be abbreviated to the fewest number of characters that still result in a unique command---the commands BASIC and BACKUP can only be shortened to BAS and BAC, because B and BA are ambiguous commands. Currently, any command requires at most four characters.

2.1.1 Qualifiers and Parameters

Qualifiers are used to modify command verbs or to provide additional processing information. Parameters usually identify the objects to be affected by the command verb.

2.1.1.1 Parameters

A DCL command can accept up to eight parameters, usually denoted as P1--P8. Multiple parameters are separated from the verb and each other by whitespace (spaces and/or tabs). For example, the COPY command copies a file; it takes two parameters, a source file name and a destination name:
$ COPY TEST.TXT TEST1.TXT

2.1.1.2 Qualifiers

There are three kinds of qualifiers: command, positional, and parameter. The following list describes each type of qualifier:

Most qualifiers are command qualifiers; the on-line help for each command will identify positional and parameter qualifiers.

COPY has a number of qualifiers that can be given. One of these is /LOG, which tells COPY to print an informational message for each file copied. /LOG is an command qualifier, so it can appear anywhere on the command line. For example, the following commands all produce the same results:

$ COPY/LOG TEST.TXT TEST1.TXT
$ COPY TEST.TXT/LOG TEST1.TXT
$ COPY TEST.TXT TEST1.TXT/LOG

An example of a positional qualifier is /COPIES for the PRINT command. If /COPIES follows the verb, it applies to all of the files to be printed; if it follows one of the parameters, it applies only to that parameter. The following commands do not produce the same results:

$ PRINT/COPIES=2 TEST.TXT,TEST1.TXT
$ PRINT TEST.TXT/COPIES=2,TEST1.TXT

In the second example, only one copy of TEST1.TXT would be printed, because /COPIES was positioned after TEST.TXT and therefore applied only to TEST.TXT.

For many commands, you can negate qualifiers by prepending NO to the qualifier. For example, you can specify COPY/NOLOG to prevent COPY from printing the informational messages (the default is /NOLOG).

Some qualifiers accept, or require, a value. For example, the /QUEUE qualifier for the PRINT command requires that you specify the name of a print queue if you wish to print to something other than your default printer. This value is supplied by adding =value to the qualifier name:

$ PRINT TEST.TXT/QUEUE=STH

Multiple values would be enclosed in parentheses and separated by commas:

$ DELETE/ENTRY=(34,35)

2.1.2 Command Prompting

DCL will prompt you for any required command parameters that are missing from the command line. To copy a file with prompting, you could type:
$ COPY  <RETURN>
_From: TEST.TXT  <RETURN>
_To: TEST1.TXT  <RETURN>

Because the source and destination were left off the command line, DCL prompted for each (_From: and _To:). The underscore (_) preceding the prompt indicates that the prompt is a continuation of the command line. When DCL is prompting for parameters, it will prompt for optional parameters too. If you don't want to provide the optional parameter, just press Return and DCL will move on to the next parameter, if there is one. If you press Return for a required parameter, DCL will simply re-prompt for that parameter:

$ COPY
_From: <RETURN>
_From: TEST.TXT  <RETURN>
_To: <RETURN>
_To: TEST1.TXT  <RETURN>

You can abort the command at any prompt by typing Ctrl-Z.

Obviously, command prompting is useful for those commands with which you are not very familiar---you can let DCL help you out by telling you what it expects.

2.1.3 Continuation Lines

You can continue a DCL command by ending a line with a dash (-). DCL will respond with the continuation prompt (_$) and you can enter the rest of the command. Continuing with the COPY examples, you could continue the line after each command component:
$ COPY -  <RETURN>
_$ TEST.TXT -  <RETURN>
_$ TEST1.TXT  <RETURN>
$

The continuation character is useful for long commands that extend past the width of the screen. The command line is easier to read when you continue it.

2.1.4 Command Line Editing

The arrow-keys (left-arrow and right-arrow) and various Ctrl key combinations can be used to edit DCL command lines. (Actually, all of these editing features are also available from within most applications.) Return and Ctrl-Z are line terminators; once either of these keys is pressed, the command prompt is terminated and DCL will attempt to parse and execute the command line.

Table 2-1 describes each of the line editing keys.

Table 2-1 Line Editing Keys
Key Effect
Ctrl-A Toggle between Insert and Overstrike modes. Changing modes with Ctrl-A affects the current line only. Use SET TERMINAL/INSERT or /OVERSTRIKE to change modes for more than one line.
Ctrl-B Recall previous commands.
Ctrl-C Cancel the current operation within a program. From the DCL prompt, Ctrl-C cancels the current command line.
Ctrl-D Move the cursor left by one character.
Ctrl-E Move the cursor to the end of the line.
Ctrl-F Move the cursor right by one character.
Ctrl-H Move the cursor to the beginning of the line.
Ctrl-I Tab
Ctrl-J Erase the word preceding the cursor.
Ctrl-M Return
Ctrl-R Refresh the command line.
Ctrl-U Erase from the cursor to the beginning of the line.
Ctrl-X Erase to the beginning of the line and purge the typeahead (the characters that have been typed but have not been displayed on the screen yet)
Ctrl-Y Interrupt the execution of the current program. Ctrl-C and Ctrl-Y have the same effect from the DCL prompt.
Ctrl-Z Line terminator (also exits most applications).

2.1.5 Recalling and Editing Previous Commands

DCL lets you recall previous DCL commands using the up- and down-arrow keys and through the DCL command RECALL. You can use the up-arrow key to step backwards through the command recall buffer; each command in the buffer is displayed at the DCL prompt, giving you the chance to edit the line and press Return to execute it again. The down-arrow key moves forward through the buffer; used together, you can step through the buffer looking for the desired command.

2.1.5.1 Enabling Command Line Editing

Command line editing is, by default, enabled for all terminals. If it is not for some reason, use the following command:
$ SET TERMINAL/LINE_EDITING

To disable line editing, simply specify /NOLINE_EDITING.

There are two qualifiers you can provide to specify the editing mode: /OVERSTRIKE, which causes typed characters to be written over the character under the cursor, and /INSERT, which causes typed characters to be inserted before the cursor. /OVERSTRIKE is the default. As noted above, Ctrl-A is used to toggle between insert and overstrike modes. Ctrl-A toggling only affects the current command line.

2.1.5.2 The RECALL Command

The RECALL/ALL command can be used to display the commands stored in the command recall buffer. Each command displayed is numbered, with the most recently executed command displayed first:
$ RECALL/ALL
 1 dir
 2 edit tmp.tmp
 3 copy/nolog test.txt test1.txt
$

Note that the RECALL command itself does not appear in the command recall buffer. You can recall a particular command in the recall buffer by specifying the command number as a parameter to RECALL:

$ RECALL 3
$ copy/nolog test.txt test1.txt

In addition to providing a command number, you can specify a substring that is used to locate a command. The first command located that begins with the specified substring is then displayed:

$ RECALL COPY
$ copy/nolog test.txt test1.txt

For security purposes, you can erase your command recall buffer with the command RECALL/ERASE.

2.2 Some Common DCL Commands

While there are a large number of DCL commands available on an OpenVMS system, new users shouldn't try to master all of them in the beginning. The following sections describe a few basic commands that are useful for customizing your environment and finding out some information about the system.

Table 2-2 provides a brief description of some basic commands. Some of the commands are described elsewhere in this guide; on-line help is available for all of them.

Table 2-2 Basic DCL Commands
HELP Access the on-line help
SHOW USERS Show all users currently logged in
SHOW TIME Show the current date and time
SHOW QUOTA Show amount of disk quota used
SET PROMPT Set the DCL prompt
SET PASSWORD Change your account's password
SET PROCESS Change various process settings
SHOW PROCESS Show process information
DEFINE/KEY Define a key to execute a command
SET TERMINAL Change terminal settings
SHOW TERMINAL Show the current terminal characteristics
SHOW SYMBOL Show DCL symbol definitions
DEFINE Define a logical
SHOW LOGICAL Show logical definitions

2.2.1 SET PASSWORD

The SET PASSWORD command is used to change your account's password. You should change your password occasionally to ensure that your account is not compromised. In fact, the system will force you to change your password every ninety (90) days.

To change your password, type SET PASSWORD at the DCL prompt. You will be prompted to enter your old password, a new password, and a verification of your new password. The following example shows the prompts:

$ SET PASSWORD
Old password: old-password
New password: new-password
Verification: new-password
$

At the Verification: prompt, simply re-type your new password. The system asks for verification just to make sure that you didn't make a typing error in your password.


Note: For security reasons, the system does not display your passwords. If the new password and its verification do not match, the password is not changed.


Passwords must be at least 6 characters long and can consist of up to 31 alphanumeric characters (A--Z, 0--9). The dollar sign ($) and underscore (_) are also permitted. Uppercase and lowercase letters are equivalent; all lowercase letters are automatically converted to uppercase.

The following guidelines should be followed when you choose a new password:

If you can't think of a password, SET PASSWORD/GENERATE can be used to generate random "pronounceable" passwords from which you can choose:

$ SET PASS/GENERATE
Old password: old-password
ayxla     ayx-la
taivoa    tai-voa
cawv      cawv
wuiv      wu-iv
tawwia    taw-wi-a
Choose a password from this list, or press RETURN to get a new list
New password: new-password
Verification: new-password
$


Note: Please guard your password carefully---you could be held accountable if another user gains access to your account for any malicious activities.


2.2.2 SHOW USERS

The SHOW USERS command displays a list of all the users currently logged into the system. By default, the display only lists the total number of processes for each logged-in username:
$ show users
      OpenVMS User Processes at 24-JUN-1996 16:44:21.16 
    Total number of users = 3,  number of processes = 6 
 
 Username      Node     Interactive  Subprocess   Batch 
 COPUSDS       AXP1           2 
 WILLIAMSCA    ALPHA          2 
 WILLIAMSCA    AXP1           1 
 BACKUPS       AXP1           -                     1 
$ 

Interactive jobs are those running from a terminal, subprocesses are children of the interactive jobs, and batch jobs are those processes executing in a batch queue (no terminal is associated with the job).

More detailed information can be displayed by appending the /FULL qualifier to the command:

$ show users/full
      OpenVMS User Processes at 24-JUN-1996 16:46:30.21 
    Total number of users = 3,  number of processes = 6 
 
 Username      Node   Process Name       PID     Terminal 
 COPUSDS       AXP1   COPUSDS          20A016C3  FTA141: 
 WILLIAMSCA    ALPHA  DECW SM          21C00056 
 WILLIAMSCA    ALPHA  Curtis 1         21C0005D  FTA1: 
 WILLIAMSCA    ALPHA  Curtis 2         21C0005E  FTA2: 
 WILLIAMSCA    AXP1   Curtis 3         20A016CA  FTA143: 
 BACKUPS       AXP1   BACKUPS          20A00225  (batch) 
$ 

As you can see, the /FULL display shows each user process and includes the process identification code (PID), the process name, and the terminal associated with the job, if there is one.

Process names can be set using the SET PROCESS/NAME command, described in Section 2.2.4.

You can optionally specify a username or part of a username to match to see if a particular user is logged on. The following example lists all users currently logged-in whose username begins with WILLI:

$ show users willi
      OpenVMS User Processes at 24-JUN-1996 16:53:47.36 
    Total number of users = 2,  number of processes = 6 
 
 Username     Node     Interactive  Subprocess   Batch 
 WILLIJP1     AXP1           1 
 WILLIAMSCA   ALPHA          3           1 
 WILLIAMSCA   AXP1           1 
$ 

2.2.3 SET PROMPT

The SET PROMPT[=string] command is used to change your DCL prompt from the default dollar sign ($). The new prompt can be any ASCII sequence of up to 32 characters. The following example shows how to change your prompt:
$ set prompt="What do you want? "
What do you want? SHOW TIME
   2-AUG-1991 08:59:43
What do you want?

If you don't specify a string, the prompt is changed back to the $.

2.2.4 SET PROCESS

The SET PROCESS/NAME command is used to change your process name, which is one of the items displayed by the SHOW USERS command. You can specify a string of 1 to 15 characters:
$ SET PROCESS/NAME="Goat Busters"

Process names must be unique within a UIC group.

2.2.5 SET-SHOW TERMINAL

The commands SHOW TERMINAL and SET TERMINAL are used to display and modify your terminal settings. Note that these commands only affect the software settings, not the hardware settings accessed via the SetUp key on the terminal.

The SET TERMINAL qualifiers /LINE_EDITING, /OVERSTRIKE, and /INSERT have already been discussed. Table 2-3 describes some other useful qualifiers.

Table 2-3 SET TERMINAL Qualifiers
/TYPE=VT200 Define this terminal as one that supports VT200-series features. A VT200-series terminal is necessary to use the certain keys (see Table 2-4 )
/NOBROADCAST Disable broadcasts (new mail notices, SENDs)
/WRAP Wrap long lines when TYPEing a file
/NOWRAP Lines are not to be wrapped
/INQUIRE Ask terminal what device type it is and modify the terminal settings accordingly
/NONUMERIC Numeric keypad keys can be defined
/NUMERIC Numeric keypad keys generate numbers

2.2.6 Defining Keys to Execute DCL Commands

You can define some of the keys on your keyboard to perform DCL commands using the DEFINE/KEY command. The format of the command is:
$ DEFINE/KEY key-name "command" [/qualifiers]

The command can be any DCL command (or part of a command); verbs and parameters or qualifiers must be enclosed in quotes. For example, the following example defines PF1 to be SHOW USERS:

$ DEFINE/KEY PF1 "SHOW USERS"/ERASE/TERMINATE

The keys that can be defined include all of the numeric keypad keys, the keys on the editing keypad above the arrow-keys, and the row of function keys along the top of the keyboard. The valid key-names are given in Table 2-4.

Table 2-4 Keys and VT Keyboards
Key Name VT200-Series VT100-Series
PF1--PF4 PF1--PF4 PF1--PF4
KP0--KP9 0,1,2,...,9 0,1,2,...,9
Period . .
Comma , ,
Minus - -
Enter Enter ENTER
Find (E1) Find n/a
Insert Here (E2) Insert Here n/a
Remove (E3) Remove n/a
Select (E4) Select n/a
Prev Screen (E5) Prev Screen n/a
Next Screen (E6) Next Screen n/a
Help Help n/a
Do Do n/a
F6,F7,...,F20 F6,F7,...,F20 n/a

The keys PF*, F*, E*, Help, and Do are always definable; the numeric keypad keys can only be used when the terminal has been set to use the application keypad (SET TERMINAL/APPLICATION or SET TERMINAL/NONUMERIC ).

Note that the arrow keys and F6--F14 are reserved for line editing. To define these keys, you must set your terminal to /NOLINE_EDITING.

There are several qualifiers you can use with DEFINE/KEY. The two most useful are /ERASE, which erases anything currently on the line, and /TERMINATE, which causes the command to be executed as soon as the key is pressed.

You can also have different key states, so keys can have multiple definitions depending on which key state is active. For more information on key states and the DEFINE/KEY command, see the on-line help or the DCL Dictionary.

The SHOW KEY command can be used to show the current key definitions.

2.3 DCL Symbols

Symbols allow you to tailor the command language by defining your own DCL commands or changing existing ones. A defined symbol can be used just like a DCL command verb; when DCL parses the command line, the symbol definition is substituted for the symbol in the command line. Symbols affect your process only, and are not saved when you log off the system. To make a symbol active each time you log in, store the symbol assignment in your LOGIN.COM file, located in your default directory and discussed in the next section.

A DCL symbol is defined using the :=, =, :==, or == assignment operators. The format of a symbol definition is:

$ symbol = "Symbol value" 

The operators := and :== let you leave off the double-quotes ("). Using an extra "=" in the operator defines a Global symbol (one that will be accessible from outside a command procedure).

The following example shows the definition of the symbol USE to mean SHOW USERS:

$ USE :== SHOW USERS

USE can now be used to display the users currently logged in.

You can also use symbols to modify standard DCL commands. For example, the following command defines the symbol DIR to mean DIRECTORY/SIZE/DATE:

$ DIR :== DIRECTORY/SIZE/DATE

Now when DIR is typed, the size and creation date of each file will be displayed. Additional DIRECTORY qualifiers can also be specified when the DIR symbol is used:

$ DIR/OWNER

This example is equivalent to the following command:

$ DIRECTORY/SIZE/DATE/OWNER

The DIRECTORY command itself is still available by specifying DIRE (or more letters if desired).

The following syntactic rules are applied to symbols:

If you want all commands that begin with a certain sequence to perform a particular function, you can use the * character in the name to tell DCL that the remaining characters aren't important. For example, the following symbol definition tells DCL that the full symbol name is DELETE, though any sequence of characters can be specified after DEL:

$ DEL*ETE :== DELETE/LOG

Using the definition above, the following commands are all equivalent to DELETE/LOG TMP.TMP;1:

$ DEL    TMP.TMP;1
$ DELETE TMP.TMP;1
$ DELROY TMP.TMP;1
$ DELA   TMP.TMP;1

Such symbols are useful for powerful commands like DELETE, where you may want to ensure that, for example, /LOG is always applied.

You can look at a symbol definition using the SHOW SYMBOL command. It takes one parameter: the name of the symbol to show. You can use wildcards in the symbol name (wildcards are described in Section 3.1.1).

$ show symbol use
  USE == "SHOW USERS"
$ show symbol u*
  UNIX_COMPRESS == "$WKU$ROOT:[EXE]UNIX_COMPRESS.EXE"
  UNZIP == "$WKU$ROOT:[EXE]UNZIP.EXE"
  USE == "SHOW USERS"
$

2.4 Logical Names

Logical names are similar to symbols in that they can be defined to be equivalent to another string, but unlike symbols, they are usually used as higher-level replacements for disks and directories. Also unlike symbols, logicals are not evaluated by DCL when commands are parsed. Instead, individual applications can use logical names as "logical" replacements for site-specific or user-specific strings.

Consider, for example, a program that must display data on your terminal. The name of the terminal to use for output could be hardcoded in the program, but then the program couldn't be used from other terminals. Instead, programs usually write to SYS$OUTPUT, which is a logical that is automatically defined to point to your terminal. Similarly, SYS$INPUT is used for input; it, too, is automatically equated to your terminal name when you log in.

Logical names are typically used to provide more "generic" device and directory names. For example, the default user disk is WKU$USER, but this is really just a logical name whose equivalence string is AXP1$DRA2:. Logical names make it easy to, for example, move directories to other disks without impacting applications and users. The user directories could be moved to disk DRA3: and the only other change that would need to be made is to define WKU$USER to point to DRA3:.

Logical names are stored in logical name tables; there are four default tables for every process on the system. Table 2-5 lists them and gives a brief description for each.

Table 2-5 Logical Name Tables
LNM$PROCESS Logicals available only to one process
LNM$JOB Logicals available to all processes in a job
LNM$GROUP Logicals available to all members of a UIC group
LNM$SYSTEM Logicals defined system-wide for all users

By default, all user logicals are created in the LNM$PROCESS table. You can define a logical using either ASSIGN or DEFINE. The format of the DEFINE command is:

$ DEFINE logical equivalence 

The ASSIGN command reverses the order of the parameters:

$ ASSIGN equivalence logical 

Logical names and equivalences can consist of up to 255 characters. Logical names follow the same naming conventions as files (the conventions are described in Section 3.1, File Specifications).

The following example shows a logical name definition and some commands that use the logical:

$ DEFINE HOME WKU$USER:[USER]   !Define HOME to be WKU$USER:[USER]
$ DIR HOME:                     !Do a directory of WKU$USER:[USER]
$ SET DEFAULT HOME:             !Set default to WKU$USER:[USER]
$ COPY TEST.TXT HOME:           !Copy TEST.TXT to WKU$USER:[USER]

You can look at logicals using the SHOW LOGICAL command. Without any parameters, SHOW LOGICAL shows all logicals defined in the four logical name tables. You can specify a single logical name to check or a wildcarded name:

$ show logical home
   "HOME" = "WKU$USER:[USER]" (LNM$PROCESS_TABLE)
$ show logical SYS$LOGIN*
(LNM$PROCESS_TABLE)
(LNM$JOB_80C04730)
  "SYS$LOGIN" = "WKU$USER:[USER]"
  "SYS$LOGIN_DEVICE" = "WKU$USER:"
(LNM$GROUP_000002)
(LNM$SYSTEM_TABLE)
$

The DEASSIGN command is used to delete a logical name. It accepts the logical name to be deleted as its parameter:

$ DEASSIGN HOME

More information about defining logical names can be found in the on-line help and in the DCL Dictionary.

2.5 Customizing Your DCL Environment

DCL command procedures are files that contain DCL commands. You can execute a DCL command procedure using the @ operator:
$ @TEST.COM

When you log in, OpenVMS automatically searches for a DCL command procedure called LOGIN.COM in your default login directory (equated to the logical name SYS$LOGIN). If the file exists, it is executed before the DCL prompt is displayed. You can create this file using an editor (described in Chapter 5) or the CREATE command (described in Section 3.2.2).

You can use your LOGIN.COM to customize your DCL environment by including symbol and logical definitions, and commands like SET PROMPT. Each line in the file must be prefixed by a $. The exclamation point (!) is a comment character; if it appears on a line, anything after it is ignored by DCL.

Example 2-1 is a sample LOGIN.COM file that shows some useful symbol definitions you may wish to add your LOGIN.COM. A LOGIN.COM is automatically created the first time you log in to the system. If you do not have a LOGIN.COM, you can copy this template from WKU$ROOT:[SOURCE]LOGIN.TEMPLATE:

$ copy wku$root:[source]login.template sys$login:login.com

Example 2-1 Sample LOGIN.COM Command File


$ sv = 'f$verify(0)'            !Turn off VERIFY mode 
$! 
$!  Define some symbols here 
$! 
$ mail :== mail/edit=(send,forw,reply=extract) !Use editor in MAIL 
$ users :== show users/full      !Make USERS mean SHOW USERS/FULL 
$! 
$!  Define some logicals here 
$! 
$ define home sys$login:         !Make HOME refer to login directory 
$! 
$!  To prevent EVE from confirming whether or not to send a mail 
$!  message (returning to default VMS behavior), remove the "!" 
$!  after the "$" in the line below. 
$! 
$! define hg_eve_skip_mail_confirm true 
$! 
$!  To set your printer default, put the desired queue name in after 
$!  sys$print and remove the ! after the $ (valid queue names are: 
$!  grise, helm, sth2, and tccw). 
$! 
$! define sys$print queue 
$! 
$!  Exit if this is not an interactive session 
$! 
$ if f$mode().nes."INTERACTIVE" then exit 
$! 
$!  To set your process name, which is displayed by SHOW USERS/FULL, 
$!  edit the following line to include the string of your choice and 
$!  remove the "!" after the "$". 
$! 
$! set process/name="Jim Bob" 
$! 
$!  You can define your numeric keypad to execute commands for you. 
$! 
$! set terminal/application             !Enable use of keypad keys 
$! define/key KP0 "USERS"/nolog/erase/termina !0 on keypad is USERS 
$! 
$ exit 


Your LOGIN.COM can be quite complex. Consult Chapter 10 for more information about DCL command procedures.