HP OpenVMS Systemsask the wizard |
The Question is:
I am a unix admin and since last few months I am trying to administer OpenVMS
systems. I got a task to write few command file and sub-routines in DCL
language.
One of the requirement is to call a sub-routine with a given set of parameters
and these parameter does not include the calling command file name but the
sub-routine should know which program called it.
I declared a symbol in the login.com:
sub-routine-name :== '@userdisk:[abc]subjob.com f$environment("procedure")'
but it resolve the symbol when i login and the value that is passed is not
correct.
I tried different sequences of quotes but could not resolve it.
I will appreciate if I get an answer.
Thanks
The Answer is :
You cannot have the lexical function executed if the symbol substitution
is implicit. However, if you are happy to make the substitution explicit,
you can define your symbols as:
$ subname == "@userdisk:[abc]subjob.com 'f$environment(""procedure"")'"
Then, when you want to use subname:
$ 'subname
The leading quote explicitly substitutes the symbol onto the command
line, so the lexical function is executed.
Alternatively, the procedure can use:
$ @userdisk:[abc]subjob.com 'f$environment("procedure")'
to invoke the target command procedure and to pass in the name of the
calling procedure. (In general, having knowledge of the caller or the
calling context -- or the name of the calling procedure, in this case
-- tends to indicate the potential for code modularity problems and
related issues.)
You could also set a symbol in the calling process and -- assuming that
the called DCL command procedure has not altered the state of the symbol
table scope to prevent it -- the called procedure can look for the symol.
The OpenVMS Wizard would strongly recommend reading the OpenVMS User's
Guide and consideration around acquiring available books such as the
Guide to Writing Real Programs in DCL -- these materials can help you
learn to use :== and == correctly, as well as learning details of symbols
and symbol substitution, logical names, foreign commands, commands such
as CALL and GOSUB, and many other DCL-related and OpenVMS-related topics.
Your question here revolves around symbol substitution, and particularly
when the symbol substitution operations are performed -- in this case,
the symbol substutution is not performed when you want it.
|