Logical Names

A logical name is a name that can be substituted for a file specification, directory specification, device name, or even another logical name. They may be used as shorthand for long file or directory names or to achieve a level of abstraction not otherwise possible.

The string to which a logical name equates is referred to as its equivalence name, a concept that will be illustrated shortly.

Abstraction Provided by Logical Names

Let's say that several users, BILL, MARY, FRANK, and BOB, all use a certain command procedure. This hypothetical command procedure uses a file called SAVED-DATA.DAT in each user's login directory. That is, BILL's file is called DKA400:[ACCOUNTING.BILL]SAVED-DATA.DAT, MARY's is DUA3:[PAYROLL.MARY]SAVED-DATA.DAT, and so forth. How can the command procedure correctly identify which file to use?

One solution might be to design the procedure to determine which user is running it and look up the user's default directory in a table. But OpenVMS has already provided a simple, more foolproof solution: the logical name SYS$LOGIN.

For each process, OpenVMS automatically defines a logical name SYS$LOGIN, which translates to the name of the login directory of that user. Try it now:

     $ SHOW LOGICAL SYS$LOGIN        "SYS$LOGIN" = "DKA100:[MIKE]" (LNM$JOB_80DCBA00) 

In the example above, the logical name SYS$LOGIN has an equivalence name of DKA100:[MIKE]. Whenever user MIKE refers to SYS$LOGIN, the system automatically interprets this as DKA100:[MIKE]. All users have their own equivalence names for SYS$LOGIN, indicating their own directories.

So, our hypothetical command procedure can merely refer to SYS$LOGIN:SAVED-DATA.DAT, which will automatically use the correct directory for each user.

Because of the flexibility inherent in logical names, they are used extensively under OpenVMS.

Logical Names as Shorthand Notations

Another primary use of logical names is to represent long file or directory specifications by shorter names. If you use a directory called PAYROLL$DISK:[ALBUQUERQUE.ENGINEERING.2002.SEPTEMBER], you might wish to use a short logical name to replace it in your commands:

     $ DEFINE THISMONTH PAYROLL$DISK:[ALBUQUERQUE.ENGINEERING.2002.SEPTEMBER]     $ DIRECTORY THISMONTH     Directory PAYROLL$DISK:[ALBUQUERQUE.ENGINEERING.2002.SEPTEMBER]     ARTHUR.RPT     BOYD.RPT     Total of 2 files.     $ PRINT THISMONTH:ARTHUR.RPT     Job ARTHUR (queue SYS$PRINT, entry 138), started on LASER2 

When using a logical name as part of a file specification, such as with ARTHUR.RPT, separate the logical name from the file name with a colon as shown in the PRINT command above.

To assign a new value to a logical name that already exists, issue another DEFINE command:

    $ DEFINE THISMONTH PAYROLL$DISK:[ALBUQUERQUE.ENGINEERING.2002.OCTOBER]    %DCL-I-SUPERSEDE, previous value of THISMONTH has been superseded 

To delete a logical name, use the DEASSIGN command. Do not terminate the logical name with a colon:

    $ SHOW LOGICAL THISMONTH      "THISMONTH" = PAYROLL$DISK:[ALBUQUERQUE.ENGINEERING.2002.SEPTEMBER]    (LNM$PROCESS_TABLE)    $ DEASSIGN THISMONTH    $ SHOW LOGICAL THISMONTH    %SHOW-S-NOTRAN, no translation for logical name THISMONTH 

Predefined Logical Names

OpenVMS maintains a number of logical names equating to process-and job-specific devices and files, including, among others, the following:

  • SYS$COMMAND—the device or file from which DCL accepts input data. For interactive processes, this is your terminal.

  • SYS$ERROR—the device to which the system writes all informational and error messages. For interactive processes, this is your terminal. For batch jobs, this is the log file.

  • SYS$INPUT—the device from which commands and data input are accepted. For interactive processes, it is usually your terminal. An exception is during execution of a command procedure, when it is temporarily assigned to the disk containing the procedure.

  • SYS$OUTPUT—the device or file to which output data are written. For interactive processes, it is your terminal. For batch jobs, it is the log file.

  • SYS$SYSDEVICE—the system disk, the disk from which OpenVMS was booted.

Logical Name Tables

All of the logical names described above are specific to your process or job. OpenVMS provides process wide, job wide, group wide, and system wide logical names by means of the PROCESS, JOB, GROUP, and SYSTEM logical name tables.

By separating logical names into separate tables, logical names may be created for the use of all system users or only those in a certain UIC group, or by individuals.

If you define a logical name in your process table with the same name as a system wide logical name, the value you define will take precedence over the system-defined value. It will not affect the value seen by other users of the system; they will continue to use the system wide value. When you deassign the process-level logical name, you will revert back to using the system wide value:

    $ !    $ ! Show the value of logical name UTIL_DIR as defined system wide.    $ ! Any references I make to UTIL_DIR will reference this value.    $ !    $ show logical util_dir       "UTIL_DIR" = "DKA100:[UTILITIES]" (LNM$SYSTEM_TABLE)    $ !    $ ! Now define my own UTIL_DIR as a process-private logical name    $ !    $ define util_dir dka400:[users.janet.utilities]    $ !    $ ! Any references I make to UTIL_DIR now will use my process-private    $ ! definition, although the system wide definition still exists:    $ !    $ show logical util_dir       "UTIL_DIR" = "DKA400:[USERS.JANET.UTILITIES]" (LNM$PROCESS_TABLE)       "UTIL_DIR" = "DKA100:[UTILITIES]" (LNM$SYSTEM_TABLE)    $ !    $ ! Deassign my process-private value    $ !    $ deassign util_dir    $ !    $ ! And now I have reverted to the system wide value:    $ !    $ show logical util_dir       "UTIL_DIR" = "DKA100:[UTILITIES]" (LNM$SYSTEM_TABLE) 

Logical Names with Concealed Translations

When a system message would include a logical name, its equivalence name is usually shown instead. However, this translation can be concealed with the /TRANSLATION_ATTRIBUTES=CONCEALED qualifier:

    $ DEFINE MYDISK DKA100:    $ DIRECTORY MYDISK:[000000]    Directory DKA100:[000000]    (...)    $ DEFINE/TRANSLATION_ATTRIBUTES=CONCEALED MYDISK DKA100:    %DCL-I-SUPERSEDE, previous value of MYDISK has been superseded    $ DIRECTORY MYDISK:[000000]    Directory MYDISK:[000000]    (...) 



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