From: afeldman@oucsace.cs.ohiou.edu (Alan E. Feldman)
Newsgroups: comp.os.vms
Subject: Re: What's the real difference between a symbol and a logical?
Date: 4 Apr 92 00:40:33 GMT
Organization: Ohio University CS Dept,. Athens

In article <009585DD.555CCEE0.7760@merrimack.edu> pa_andy@MERRIMACK.EDU (The Wolf) writes:
>In 25 words or fewer, what's the difference between a symbol and a logical?
>-------------------------------------------------------------------------------
>Andy Harrington       Computer Geek       Merrimack College, N. Andover, MA
>pa_andy@merrimack.edu      This is a public forum ... not a uterus. - Daniel
>-------------------------------------------------------------------------------

I first tried to mail this to the poster, but it bounced. Further, even
though there have been many responses to this posted already, I feel
that this is sufficiently different to be worth posting. 

I think I've got it! In 25 words or less: 

Symbols are variables IN DCL COMMANDS. Logical names are alias names
for objects (file-specs, queue_names, printer_names, etc.) and are
generally usable "anywhere." 

Alright, I cheated slightly. If I were allowed more words: Symbols can
be used as abbreviations for DCL commands. They can also be used as
variables in DCL commands and/or command procedures (but not in data
lines because for them, control has been passed to another program!).
Logical names are aliases for objects and can usually be used almost
anywhere in that context. These objects include file specifications (and
any leading part thereof), queue names, mail addresses, terminal names,
printer names, .... 

Detailed version (all the essentials [and possibly more] for the
novice): Consider DCL to be just another program. The operating system,
VMS, is always "there," but DCL isn't. DCL has its rules for translating
symbols. VMS has a different set of rules for translating logical names.
When you run another program, you are not "running" DCL (even though you
are likely running the program via a DCL command!). Therefore, you
cannot normally use symbols in user-written programs. Also, symbols are
variables that can store integers or character strings when used in a
DCL command. (As integers, they can be added and subracted, also.)
Symbols are translated if they are: (1) the first word in a command, (2)
preceeded by a ' or &, (3) the argument of a lexical function, and (4)
possibly others (see the DCL Concepts and Guide to DCL Command
Procedures manuals). Because each process is running DCL separately,
symbols are process specific, more or less. I can, but will not
elaborate on the previous sentence in this article (or possibly ever!) 

Logical names can store character strings and are translated
automatically by the VMS operating system when specified in the context
of an object. The object can be any leading part of a file specification
(see TFM for the correct syntax), a whole file specification, a queue, a
printer, a terminal, a tape drive, any other device (or at least most
others I believe), a mail address, and probably several others that I
can't think of offhand. Since the operating system is needed to provide
access to the object, it is available to perform the logical name
translation. Thus, logical names can be used almost anywhere if used in
the context of an object. Also, their scope can be anywhere from
process-specific to cluster-wide. Still further, when logical names are
used in a DCL command, the command interpreter (DCL) finishes its
command processing before any logical name translation is preformed. 

On the other hand, both symbols and logical names can be evaluated (but
not "used in their normal ways") in a user-written program via special
Run-Time Library functions (at least in VAX-FORTRAN!). 

I hope that a careful reading of this will help make it clear to the VMS
novice! Further, this article is NOT intended to be a complete
description of symbols and logical names.

Disclaimer: The author alone is responsible for the content of this 
article. 

Alan E. Feldman  &-)  Dept. of Physics, Ohio U., Athens, OH 45701
Preferred addresses:  FELDMAN@OUALV1.PHY.OHIOU.EDU, 
                      FELDMAN@OUALVX.PHY.OHIOU.EDU
If you prefer Bitnet: FELDMAN@UMDENP