[Digital logo]
[HR]

OpenVMS User's Manual


Previous | Contents

There are two ways to change the default search order:

13.12.3 Example

In the following example, the system searches the process and system tables only:

$ DEFINE/TABLE=LNM$PROCESS_DIRECTORY - 
_$ LNM$FILE_DEV LNM$PROCESS,LNM$SYSTEM

The equivalence strings for LNM$FILE_DEV do not include LNM$JOB and LNM$GROUP; therefore, subsequent commands that need to translate a logical name will not search the job or group tables.

13.12.4 Iterative Translation

Logical name translation can be iterative: after the system translates a logical name, it repeats the translation process for any logical names it finds contained within the first logical name.

The system limits the number of levels to which it performs logical name translation. The number of levels varies among system facilities but it is at least nine. If you define more than the system-determined number of levels or if you create a circular definition, an error occurs when the logical name is used.

13.12.5 Example

In the following example, the first DEFINE command equates the logical name DISK to the device name DUA1. The second DEFINE command equates the logical name MEMO to the file specification DISK:[JEFF.MEMOS]COMPLAINT.TXT:

$ DEFINE DISK DUA1:
$ DEFINE MEMO DISK:[JEFF.MEMOS]COMPLAINT.TXT

When the system translates the logical name MEMO, it finds the equivalence string DISK:[JEFF.MEMOS]COMPLAINT.TXT. It then checks to see whether the leftmost component in this file specification ends in a colon, a space, a comma, or an end-of-line terminator. It finds a colon after DISK. The system translates that logical name also. The final translation of the file specification is:

DUA1:[JEFF.MEMOS]COMPLAINT.TXT 

13.12.6 System Defaults During Logical Name Translation

When the system translates a logical name, it fills in any missing fields in a file specification with the current default device, directory, and version number. When you use a logical name to specify the input file for a command, the command uses the logical name to assign a file specification to the output file as well.

If the equivalence string contains a file name and file type, the output file is given the same file name and file type. If the equivalence string does not contain a file type, a default file type is supplied. The file type supplied depends on the command you are using.

When you use logical names in a list of input files, the equivalence string of each logical name provides a temporary default.

13.12.7 Example

In the following example, because a device name is not specified for the logical name HIG, the device name for MAL defines DBA1 as the temporary default device:

$ SET DEFAULT  DBA2:[CASEY]
$ DEFINE MAL DBA1:[MALCOLM]
$ DEFINE HIG [HIGGINS]
$ PRINT ALPHA,MAL:BETA,HIG:GAMMA

The PRINT command looks for the following files:

13.13 Search Lists

When you use a search list in a file specification, the search list is translated as follows:

When you specify a search list as the first part of the parameter for the SET DEFAULT command, the system assigns the search list name, untranslated, to SYS$DISK. (SYS$DISK is a logical name that translates to your default disk.) Note that when you specify a search list as the first part of a parameter for the SET DEFAULT command, each equivalence string in the search list must contain a device name.

13.13.1 Examples

13.13.2 Search Lists with Wildcards

When you use a search list with a command that does not accept wildcards in a file specification, the system forms a file specification by using each equivalence string in the search list until a file specification for an existing file is found. The command affects only the first file found. The system displays an error message only after it checks all equivalence strings in a search list. Then, the system reports an error only on the last file it attempts to find.

13.13.3 Example

In the following example, the system forms the file specification DISK1:[FRED]QUOTAS.TXT and searches for that file:

$ DEFINE DECEMBER DISK1:[FRED],WORK2:[BARNEY]
$ EDIT/EDT DECEMBER:QUOTAS.TXT

If QUOTAS.TXT is found in DISK1:[FRED], it is opened for editing. No other files are subsequently opened. If QUOTAS.TXT is not found in DISK1:[FRED], the system searches for it in WORK2:[BARNEY]. If QUOTAS.TXT is found there, it is opened. If it is not found, an error message displays.

13.13.4 Using the RUN Command with Search Lists

When the RUN command is followed by a search list, the system forms file specifications as described previously. However, the system then checks to see whether any of the files in the list are installed images. The system runs the first file in the search list that is an installed image. Then, the RUN command terminates.

If none of the file specifications are installed images, the system repeats the process of forming file specifications. This time it looks for each file specification on the disk. It runs the first file it finds there. An error message is displayed if none of the specified files is found in either the known file list or on the disk.

13.13.5 Search Order for Multiple Search Lists

A file specification can contain more than one search list. When this occurs, each item in the file name search list is used, while the first device name is held constant. After all the items in the file name search list have been combined with the first device name, they are combined with the second device name. This continues until each device has been searched.

You can also have iterative (nested) search lists when one name in a search list translates to another search list. If this occurs, the system uses each name in a sublist before continuing to the next upper level name.

13.13.6 Examples

13.13.7 Logical Names in Multiple Tables

Multiple tables with the same name can exist. For example, there can be both a process-private and a shareable table called MY_TABLE. The process-private version always takes precedence over the shareable table in all logical name table processing. When a logical name such as LNM$FILE_DEV is used as a table name, the logical name is iteratively translated until a list of table names is formed. During this iterative translation, each name is first translated in the process directory. If this translation fails, it is then translated in the system directory. This order of precedence cannot be changed. As a consequence of this ordering, a logical name placed in the process directory table for use as a table name always takes precedence over any identical name residing in the system directory.


Chapter 14
Symbols: Defining Commands and Expressions

14.1 Overview

A symbol is a name that represents a numeric, character, or logical value (such as true or false). When you use a symbol in a DCL command line, DCL replaces the symbol with its value before executing the command.

This chapter describes:

For additional information, see the following:

14.2 About Symbols

You can use symbols in the following ways:

14.2.1 Example

In the following example, a symbol is created to set default to a directory that is accessed often. These commands show how to define and use the symbol WORK to set default to the WORK1:[JONES.WORK] directory:

$  WORK :== SET DEFAULT DISK1:[JONES.WORK]
$  WORK
$  SHOW DEFAULT
   DISK1:[JONES.WORK]

14.2.2 Comparing Logical Names and Symbols

Although logical names and symbols appear similar, they are used differently. The following table compares the function, usage, and other characteristics of logical names and symbols:
Characteristic Logical Names Symbols
Function Represent device, directory, file, queue, and other system object specifications. Represent commands or portions of command strings.
Usage Are used in place of any complete device, directory, file, queue or other system object specification. Logical names must be used as part of a command string parameter to be passed to the file system for translation. Are used in place of any command string. Symbols must be used as the first word in a command string to be translated by the command language interpreter.
Storage Are stored in your process, job, group, or system logical name table. See Section 13.5. Are stored in your global or local symbol table. See Section 14.11.
Creation Use either the ASSIGN or DEFINE command to create a logical name. See Section 13.4. Use an assignment statement (= or :=,=) to create a symbol. See Section 14.3.
Display Use either the SHOW LOGICAL or SHOW TRANSLATION command to display a logical name. See Section 13.8. Use the SHOW SYMBOL command to display a symbol. See Section 14.4.
Deletion Use the DEASSIGN command to delete a logical name. See Section 13.9. Use the DELETE/SYMBOL command to delete a symbol. See Section 14.3.12.

14.3 Using Symbols

The following sections describe how to define and use symbols.

14.3.1 Types of Symbols

You can create two types of symbols, local and global. Local symbols are accessible from the current command level and from command procedures executed from the current command level. Global symbols are accessible at all command levels.

14.3.2 Defining Symbols

You can define a symbol with a character string, a number, a lexical function, a logical value, or another symbol. The symbol name can be 1 to 255 characters long and must begin with a letter, an underscore (_), or a dollar sign ($). In a symbol name, both lowercase and uppercase letters are treated as uppercase.

14.3.3 Using the Assignment Statement

To create a symbol, use the assignment statement (= or :=,=) or the string assignment (:= or ::=,=). When you use the string assignment, all alphabetic characters are converted to uppercase and multiple spaces and tabs are compressed to a single space. You can use string assignments to create a symbol that represents a DCL command or to define a foreign command (note that in either case, there is a 255-character limit). To continue a character string over two lines in a string assignment, use a single hyphen.

You can also create symbols by using the READ and INQUIRE commands (see Chapter 15 and Chapter 16).

14.3.4 Examples: Creating Local Symbols

14.3.5 Examples: Creating Global Symbols

14.3.6 Using Symbols to Represent DCL Commands

You can define a symbol to represent a DCL command in your login command file (LOGIN.COM) or interactively at DCL level. When you define the symbol in your login command file, you can use the symbol each time you log in; when you define the symbol interactively, the symbol can be used only during the current process.

If you define a symbol with the same name as a DCL command, your definition overrides the DCL command name. For example, if you define the symbol HELP as the command TYPE HELP.LST, you can no longer invoke the system's Help utility by typing HELP.

14.3.7 Symbol Abbreviation

Use the asterisk (*) to create a symbol that can be abbreviated. Generally, you can use abbreviated symbol definitions in any situation that allows a symbol to be used. Symbols that involve substring replacement are an exception. See Section 14.7.12 for more information.

Note that existing symbols might be superseded. If an existing symbol exactly matches the new symbol at or past the asterisk, the new symbol replaces the existing symbol. In addition, you cannot define another symbol whose name partly matches the existing symbol at or past the asterisk.

14.3.8 Example

The following example creates the local symbol PRINT, which can be abbreviated as PR, PRI, or PRIN:

$ PR*INT = "PRINT/CONFIRM/QUEUE=AKI$LN03/NOTIFY/RESTART"

To execute the DCL command PRINT with the specified qualifiers, you can enter the symbol or any of its abbreviations.

14.3.9 Defining Foreign Commands

If you equate the file specification of a non-DCL image to a symbol, you can run the image by typing the symbol name. A symbol that runs an image is referred to as a foreign command. A foreign command is an image that is not recognized by the command interpreter as a DCL command. (Note that, like each element of a DCL command, a foreign command has a 255-character limit.)

The formats for defining a symbol as a foreign command are as follows:

symbol-name :=[=] $image-file-spec
symbol-name =[=] "$image-file-spec"

Note that when the dollar sign ($) precedes a file specification at the beginning of a symbol definition, without any space between the dollar sign and the file specification, the request to run the image is implied.

For the image file specification, the default device and directory name is SYS$SYSTEM, the default file type is .EXE, and the default file version number is the highest version.

An alternative to using a foreign command is to define new commands with the Command Definition utility. See the OpenVMS Command Definition, Librarian, and Message Utilities Manual for more information.

There is also a method for executing foreign commands automatically, without specifying symbols. See Section 14.15 for more information.

14.3.10 Example

14.3.11 Symbol Substitution

The command interpreter looks for symbols enclosed by apostrophes (') and translates them. Thus, if you use symbols or lexical functions preceded by apostrophes to specify parameters, symbol substitution occurs (see Section 14.13). Otherwise, the command interpreter does not parse the line. The image must obtain the parameter and perform any parsing or evaluation of the command line.

14.3.12 Deleting Symbols

The DELETE/SYMBOL command deletes a symbol. To delete a global symbol, include the /GLOBAL qualifier. For example, to delete the global symbol TEMP, enter the following command:

$ DELETE/SYMBOL/GLOBAL TEMP

14.4 Displaying Symbols

The SHOW SYMBOL command displays the values of symbols. To display the value of a particular symbol, enter the SHOW SYMBOL command followed by the name of the symbol. To display the value of a particular global symbol, include the /GLOBAL qualifier. The SHOW SYMBOL/ALL command displays all local symbols. The command SHOW SYMBOL/ALL/GLOBAL displays all global symbols.

Note that when a symbol has an integer value, the SHOW SYMBOL command displays the value in decimal, hexadecimal, and octal notation.

14.4.1 Examples

14.5 Using Symbols with Other Symbols

The following sections describe how to use symbols with other symbols.

14.5.1 Defining a Symbol as a Symbol

After you define a symbol, you can use it as part of the definition of another symbol. DCL interprets a symbol as a character string or a number, depending on the context in which you use the symbol.

14.5.2 Example

In the following example, the integer value 3 is assigned to the symbol COUNT:

$ COUNT = 3

The value of COUNT can then be used in other assignment statements. For example, here the value of COUNT is added to 1:

$ TOTAL = COUNT + 1

The result (4) is equated to the symbol TOTAL.

14.5.3 Symbol Concatenation

You can concatenate several symbols to create a long character string by using the plus sign (+). You can also concatenate two or more symbols by placing apostrophes (') around each symbol name.

For more information on requesting symbol substitution, see Section 14.13.7.

14.5.4 Examples

14.5.5 Including Symbols in String Assignments

To include a local symbol in a string assignment, use a colon and an equal sign (:=). To include a global symbol in a string assignment, use a colon and two equal signs (::=,=). For either type of symbol (local or global), enclose the symbol in apostrophes (' '). Otherwise, DCL will not recognize it as a symbol.

If you define a null character string for a symbol, that symbol has a value of 0.

14.5.6 Examples

14.6 Using Symbols to Store and Manipulate Data

The following sections describe how to use symbols to store and manipulate data.

14.6.1 Variables

You can use symbols as variables in command procedures. Variables hold values that you calculate or assign as something other than a literal value. For example, you might assign the value of a lexical function to a variable or read the value of a file record into a variable.

14.6.2 Expressions

An expression is a combination of values. In command procedures, expressions are used in symbol assignment statements (on the right side of the equal sign), in IF statements, in WRITE commands, and as arguments for lexical functions.

When you define a symbol, the left side of the assignment statement defines the symbol name; the right side of the assignment statement contains an expression. Each value (also called an operand) in an expression can be connected to another value by an operator. DCL evaluates the expression and assigns the result to the symbol. If an expression is evaluated as a character string, then the symbol has a string value.

14.6.3 Example

In the following example, the local symbol BARK is equated to an expression that adds three numbers:

$ BARK = 1 + 2 + 3 

The operands are 1, 2, and 3. The operator is the plus sign (+). The evaluated expression is an integer, so the symbol has an integer value.

14.7 Character Strings

A character string can contain any characters that can be printed. Appendix B includes tables of the ASCII character set and the DEC Multinational character set. These tables list characters you can include in a character string.

14.7.1 Types of Characters

Characters fall into three main categories:

14.7.2 Defining Character Strings

You can define a character string by enclosing it in quotation marks (" "). In this way, alphabetic case and spaces are preserved when the symbol assignment is made. Note the following:

14.7.3 Examples

14.7.4 Character String Expressions

A character string expression can contain character strings, lexical functions that are evaluated as character strings, or symbols that have character string values. When you use a character string in an expression, you must enclose it in quotation marks (" "). If you do not use quotation marks, DCL processes the string as a symbol.

14.7.5 Character String Expression Operands

Character string expressions combine the following values (called string operands):


Previous | Next | Contents | [Home] | [Comments] | [Ordering info] | [Help]

[HR]

  6489P023.HTM
  OSSG Documentation
  22-NOV-1996 13:17:10.41

Copyright © Digital Equipment Corporation 1996. All Rights Reserved.

Legal