[Info-vax] puzzled by DCL symbol substitution

AEF spamsink2001 at yahoo.com
Tue Jan 17 20:18:33 EST 2012


On Jan 17, 7:54 pm, AEF <spamsink2... at yahoo.com> wrote:
> On Jan 7, 12:46 pm, hel... at astro.multiCLOTHESvax.de (Phillip Helbig---
>
> undress to reply) wrote:
> > In article
> > <09f5e110-6aa3-44f0-a0bc-d40559d2f... at z1g2000vbx.googlegroups.com>, AEF
>
> > <spamsink2... at yahoo.com> writes:
[...]
>
> > Are there examples of ''&SYMBOL' anywhere in the DCL procedures supplied
> > with VMS?  A quick search found something superficially similar:
>
> >    SYS$COMMON:[SYSMGR]DECW$STARTAPPS.COM;1
>
> >    $       define/system/exec/nolog 'P2' "''F$EDIT(&P1,"UPCASE")'"
>
> > Interestingly, it doesn't work if one uses this as a one-line procedure,
> > but removing the "&" makes it work.  Discuss.
>
> You don't need more than one line as long as the value of P1 is also a
> symbol.

That should have been: "You don't need more than one line; you simply
need the value of P1 to be a
symbol."


> Example:
>
> $ ZERO:=ONE
> $ ONE:=TWO
> $ TWO:=THREE
> $ THREE:=FOUR
> $
> $ EV F$STRING("ZERO")
> ZERO
> $ EV F$STRING('ZERO')
> TWO
> $ EV F$STRING(&ZERO)
> TWO
> $ EV F$STRING("''ZERO'")
> ONE
> $
> $ SHOW SYMBOL EV
>   EV*ALUATE == "WRITE SYS$OUTPUT"
> $
>
> In the first case you simply have ZERO in quotation marks and that's
> your string.
>
> In case 2, first phase of symbol substitution changes 'ZERO' to ONE.
> Now you have ONE as a symbol which the lexical function evaluates,
> giving TWO.
>
> In case 3, second phase changes &ZERO to ONE, and the rest follows as
> in case 2. Apparently, even though you cannot use & in the middle of
> an alphanumeric string (example: FIRST&SECOND), you can use it after a
> parenthesis. Apparently, the parenthesis is a special character. From
> the manual:
>
> An ampersand must follow a delimiter (any blank or special character).
>
> So it's not even really necessary, though it's interesting. You might
> think it saves a character, but you don't need the trailing
> apostrophe:

Sorry, I posted prematurely.

$ EV F$STRING('ZERO)
TWO
$

>
> > > Back to VMS: Does it say anywhere that COPY NL: filename creates a new
> > > file? And there are some other tricks I can look up as examples.
>
> > Why would it NOT create a new file?
>
> Well, COPY copies a file. So if there is no file to copy, it can't
> perform its function. You can't run $ RENAME NLA0: blah ! because
> RENAME renames files, not devices. On the other hand, you could
> consider COPY NL: <filename> to work like a photocopy machine -- sort
> of -- in which case it makes sense -- sort of. If you don't place a
> document in the photocopy machine, pressing Start will make a copy of
> the bottom of the thing that swings down to the platen. If you leave
> it open, you don't really get a copy of anything, except the
> accidental pattern that exists at the platen from all the light coming
> from the lights in the area.

Well, that should be "glass platen", I guess.

>
> [...]
>
> AEF

AEF



More information about the Info-vax mailing list