[Info-vax] defining a symbol as an action invoked when entered as command

hb end.of at inter.net
Sat Mar 28 16:45:18 EDT 2020


On 3/28/20 5:15 PM, Phillip Helbig (undress to reply) wrote:
> In article <r5nqfq$7va$1 at dont-email.me>, Stephen Hoffman
> <seaohveh at hoffmanlabs.invalid> writes:
> 
>> As for your DCL question, the usual solution is to write part of the
>> DCL procedure at run-time, and then execute it.
> 
> Yes, but considering that a one-line procedure can be called to do the
> job, I can write it once and just define a symbol to call it.  It's not
> a big deal; I was just wondering whether it could be done ("define a
> symbol which when executed defines a logical name with the value of the
> current path as the value").
> 

 From the fine manuals ...

DCL evaluates symbols and lexical functions preceded by apostrophes in 
phase one (of command processing). DCL evaluates a symbol if it is used 
as a command in phase two. Also in phase two symbols preceded by 
ampersands are evaluated. Ampersand only applies to symbols, not to 
lexical functions. Then in phase three there is expression evaluation.

As you probably noticed, what you want to do works for "write":

$ t = "write sys$output f$time()"
$ t
28-MAR-2020 16:10:09.44
$ t
28-MAR-2020 16:10:10.62
$

As you also may have noticed, here is no substitution character at all. 
This works because write accepts as second parameter an "$expression" 
and expressions are evaluated by DCL as explained above, where an 
expression can consist of symbols and lexical functions.

Have a look at sys$update:dclint.cld, where "define" is defined. 
"parameter p2" is of type "$old_file". Change the type to "$expression" 
and do a set command. Now you can set up your (global) symbol as "define 
here f$env(""procedure"")" and use the symbol as a command.

If you can live with the implications of the different type, you have a 
solution.




More information about the Info-vax mailing list