[Info-vax] defining a symbol as an action invoked when entered as command
Jim
mckinneyj at leidos.com
Sat Mar 28 17:43:59 EDT 2020
On Saturday, March 28, 2020 at 4:45:30 PM UTC-4, hb wrote:
> 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.
Very nice... and, rather than modify the current definition of DEFINE maybe just create a new one, say DEFHERE, using a modified extraction of the command definition in that file to create a new DCL verb.
If I didn't make any typos this should work...
$ create defhere.cld
$deck
define type tran_attr
keyword concealed
keyword terminal
define type name_attr
keyword confine
keyword no_alias
! order of quals must be maintained
define verb defxxx
cliroutine define
prefix cli$k_defi_
parameter p1,prompt="Log name",value(required,type=$outlog)
parameter p2,prompt="Equ name",value(required,type=$expression,list)
qualifier system
qualifier group
qualifier job
qualifier process
qualifier user_mode
qualifier supervisor_mode
qualifier executive_mode
qualifier table,value(required)
qualifier log
qualifier name_attributes,
value(type=name_attr,list)
qualifier translation_attributes,.
placement=positional,
value(type=tran_attr,list)
qualifier cluster_system
qualifier reserved
$eod
$ set command/replace defhere.cld
$ x = "defxxx here f$environment(""default"")"
$ x
More information about the Info-vax
mailing list