[comp.os.vms] assign/define

MCGEE@NUACC.ACNS.NWU.EDU (Randy McGee) (04/20/88)

> Is there any difference in the effects of assign and define?  Is there
> a reason to prefer one to the other?

Yes. A subtle one.  If you look closely in the DCL dictionary, you will find 
that the ASSIGN statement has a bracketed colon (aka optional) after the 
logical-name parameter.  DEFINE does not.  Consider the following example

   $ ASSIGN string Y:
   $ DEFINE Y: string

ASSIGN strips the colon and defines the logical name "Y" as "string", where 
as DEFINE does *NOT* strip the collon and defines the logical name "Y:" as 
"string".

This has caught a few programmers when they've done things like:

   $ DEFINE/USER_MODE SYS$COMMAND: SYS$INPUT:
                  or
   $ DEFINE/USER_MODE SYS$OUTPUT: file

and couldn't figure out why it didn't work.

Note that it is almost impossible to use logical names that have a colon in 
them since DCL and RMS attempt to take what is in front of the colon you 
specify and interpret it as a logical name.  To DEASSIGN a logical name that 
has a colon, you have to use two colons:

   $ DEASSIGN Y::

However, this is not a global solution since RMS treats two colons as 
specifying a DECnet node name.

Enough of this.  I could go on for quite a while about all the weird side 
effects and how it can be (mis)used.  Suffice it to say that it is a subtle
difference which can cause major headaches.

V(AX W)izard
Randy McGee (MAGOO) <mcgee@nuacc.acns.nwu.edu>     Phone:    (312) 491 4079
Academic Computing and Network Services            USPost:   2129 Sheridan Road
Northwestern University                                      Evanston, IL  60208
-------