[comp.os.vms] ASSIGN vs. DEFINE

WIZARD@RITA.ACS.WASHINGTON.EDU ("The Bandit . . . ", on RITA) (04/20/88)

(My system's MAILER is eating the MAIL headers, so I don't know who *really*
sent the following messages.  Also, I haven't been receiving the massive
influx of INFO-VAX MAIL that others seem to.)

Someone asked, some time ago, the following questions.
> Is there any difference in the effects of assign and define?  Is there
> a reason to prefer one to the other?

Eric Loyd <ECL6895@RTIVAXB> responded thus:

>        The only difference between assign and define is the order that
>    the logicals and the translations will be placed in.  Example:
>
>                DEFINE USER_NAME ECL6895
>                ASSIGN ECL6895 USER_NAME
>
>        Both of the above statements will make the logical "USER_NAME"
>    equal to the equivalence stringof "ECL6895".  There is no real
>    preference for either of these statements, except to say that each
>    has a different function when used with qualifiers.  Look in the
>    HELP files for both to see more information.

What Eric says is not entirely true, as long-time VMS users may already know.
Although ASSIGN and DEFINE both create logical names, they do so in different
ways.  The obvious difference is that the order of the arguments is reversed.
The not so obvious difference is that the two commands treat the logical name
string differently!

Way back when, ASSIGN and DEFINE were designed for different purposes.  ASSIGN
was to be used to create logical names for "disk" device specifications.
DEFINE was to be used to create "generic" logical names.  Few people seem to
have ever known this, and it may not be important now, but the it does explain
why the two commands behave differently.

Try the following:

        $ ASSIGN DUA0: DISK0:   ! Note the colon.
        $ SHOW LOGICAL DISK0:   ! Again, note the colon.

The SHOW LOGICAL command will give you an error, because THERE IS NO LOGICAL
NAME "DISK0:".  The command

        $ SHOW LOGICAL DISK0

will show you that there is a logical name "DISK0" which translates to "DUA0:".

Now, try:

        $ DEFINE DISK0: DUA1:
        $ SHOW LOGICAL DISK0:
        $ SHOW LOGICAL DISK0

Now, both "DISK0:" and "DISK0" are logical names.

Derek Haining
Academic Computing Services
University of Washington
Seattle, Washington
(206) 543-5852

WIZARD@UWARITA.BITNET
        -or-
WIZARD@RITA.ACS.WASHINGTON.EDU
-------