OpenVMS Fundamentals

DCL


DCL, or Digital Command Language, is
the system-level language used in the VMS environment. By using DCL commands, you tell the system to perform various tasks. DCL commands are issued in response to the system dollar sign ($) prompt.*1 This section describes only a subset of DCL--including some commands with which you may already be familiar. The following topics are described in this section:

Command Syntax

VMS commands take the following form:

COMMAND/QUALIFIER parameter/qualifier
The command itself is always the first element to be entered on the command line.
Commands can be abbreviated to a few letters, generally, four or less. For example, the TYPE can be entered using only the letters TY.

A qualifier is an option. Qualifiers can be used to modify the effect of the DCL command or to specify additional information to the command. Qualifiers can be specified either immediately after the command, or after the parameters--or both. Wherever the qualifier is placed, it is always preceded with a slash (/). More than one qualifier can be used with any command or parameter at a time.

For example, Figure 2.1 shows a simple DIRECTORY command to tell the system to display a listing of all files in the current directory. The command is then reissued, but this time with the SIZE and DATE qualifiers; SIZE lists the amount of disk space each files uses, DATE lists the file creation date and time. Sizes are expressed in blocks, each of which is 512 bytes.



Figure 2.1: Qualifiers Modify the Behavior of Commands

The example in Figure 2.1 shows how a qualifier can be specified by placing the switch next to the command, but as we mentioned earlier, the switch can also be placed next to the parameters. For example, in Figure 2.2, qualifiers are placed next to both the command and the parameter. In the following PRINT command, the qualifier next to the command tells the system which printer to use, while the qualifier next to the parameter specifies the number of copies to be printed.



Figure 2.2: Qualifiers Used with a PRINT Command

Parameters are the objects on which the command operates. The parameters needed for each command are listed in the OpenVMS DCL Dictionary, or in the online help (accessed by typing the HELP command, which takes the name of the command you want to know about as an optional parameter). For example, to see what parameters can be used with the DIRECTORY command, you could type:

$ HELP DIRECTORY
The help facility would tell you, for example, that the DIRECTORY command can take, as a parameter, the name of a specific directory other than the current default directory (directories are discussed in more detail on page
48). For example, if you want to see what files can be accessed in the top level directory of STSDAS, you could type the following command:

$ DIRECTORY DISK$STSDAS:[STSDASX.PKG]
The system will prompt you for parameter values if you don't specify a value for a command's required parameters.

Basic Commands

The following table lists some of the most commonly-used DCL commands. Remember that DCL commands are issued in response to the system prompt ($). If you need more information about these commands, use the online help facility. Keep in mind that commands can be abbreviated.



Table 2.1: Key DCL Commands

Let's look at each of these commands in a bit more detail.

   $ @LOGIN.DAT
   $ CC CALCCOORDS
					   $ COPY MANUAL.TEX WRKNG_MANUAL.TEX

Figure 2.3: Creating a File

   $ DELETE APJ_LETTER.TEX;12
   $ DIRECTORY
   $ FORTRAN PXL_SET
   $ HELP FORTRAN
   $ LINK PXL_SET
   $ PASCAL QUICKSORT
   $ PRINT MAIL.LIS
   $ PURGE 
   $ RUN QUICKSORT

Table 2.2: SET Parameters

Table 2.3: SHOW Parameters

 $ TYPE MSG.TXT

Line Editing and the Recall Buffer

Have you ever typed a 40 character command only to get an error message? The VMS operating system has a line editor that will let you recall and edit your last 20 commands. Figure 2.4 shows an example of the RECALL command being used to list previous commands. The RECALL command can recall all or any one of your 20 most recent commands. By pressing the up arrow you can also recall your previous command. The line editor has two modes: insert and overwrite. Pressing - will toggle between the modes. By using the arrow keys, you can move left and right along the command line. Table 2.4 lists other line editing commands that you can use.



Figure 2.4: Using the Recall Buffer

Table 2.4: Line Editing Commands

Control Operations and Flow

Different terminals behave in different ways, and you need to be familiar with your terminal. Some of the most important operations are generated by pressing the key (on some terminals this key is marked or the ) while simultaneously pressing another key. These are known as control operations, and they control the execution of your process on the system, or the flow of characters from the system to your terminal. Some control operations are echoed to the screen; these are identified by a caret (^).

If you make a mistake while typing, you can press the key (marked as the key on most keyboards, and occasionally marked as on older terminals). This will delete the previously typed character. Do not press the (or ) key for this purpose because the two keys operate differently.

On some terminals, pressing ( ) will cause the system to display a backslash character and the character deleted. When you press another key, another backslash will be printed enclosing the deleted character. If you press - the command line will be redisplayed correctly.

Table 2.5 describes some of the most important control operations.

Table 2.5: Control Operations

Procedures

Any user can write and run a list of DCL commands; this is known as a procedure. A command procedure is executed using the @ character before the file name (which generally ends in a .COM file type). A simple example of a command procedure is shown below.

$ START: 
$ SHOW TIME 
$ WAIT 00:00:30 
$ GOTO START
This procedure will display the time every 30 seconds until you press - . If the procedure was stored in a file named TIME.COM, then it would be executed by typing the following command:

$ @TIME
Up to eight parameters (called P1 through P8) can be defined in a command procedure. These parameters are then passed values when the procedure is invoked. For example, let's change the previous command procedure to use a parameter to define the length of time that should elapse before the system redisplays the time. The following example shows how this can be done.

$ START: 
$ SHOW TIME 
$ WAIT 'P1' 
$ GOTO START
The new procedure would then be invoked using the following command to show the time every minute:

$ @TIME 00:01:00
Command Syntax
Figure 2.1: - Qualifiers Modify the Behavior of Commands
Figure 2.2: - Qualifiers Used with a PRINT Command
Basic Commands
Table 2.1: - Key DCL Commands
Figure 2.3: - Creating a File
Table 2.2: - SET Parameters
Table 2.3: - SHOW Parameters
Line Editing and the Recall Buffer
Figure 2.4: - Using the Recall Buffer
Table 2.4: - Line Editing Commands
Control Operations and Flow
Table 2.5: - Control Operations
Procedures

Generated with CERN WebMaker