OpenVMS 中的 DCL 符号语法
我对 OpenVMS 的 DCL 中的一些语法感到非常困惑。例如,这些是一些让我困惑的行:
$ wo = "write sys$output"
它是否为 write sys$output 创建一个符号 wo
?
$ billing_run_number == p1
p1
是执行时传递给 .com 文件的参数吗?可以提供多少个参数?
$ wo "BILLING_RUN_NUMBER = ''billing_run_number'"
''abc' 是否被符号 abc 的内容替换?为什么是“abc”而不是“abc”?我们可以使用“”吗?
$ if ((status .nes. "P") .and. (status .nes. "M")) .or. (ftp_status .nes. "Y")
.nes.
是什么意思?平等的?我也见过.ne。 ,.eqs。也。它们有什么不同呢?
为什么“和”和“或”被两个点包围? DCL 特定语法?
I am really confused by some syntax in the DCL of OpenVMS. For example, these are some of the lines which confused me:
$ wo = "write sys$output"
Does it create a symbol wo
for write sys$output?
$ billing_run_number == p1
Is p1
a parameter passed to the .com file when it was executed? How many parameters can it be supplied with?
$ wo "BILLING_RUN_NUMBER = ''billing_run_number'"
Is ''abc' substituted by the content of the symbol abc? Why is it ''abc' but not 'abc'? Can we use ""?
$ if ((status .nes. "P") .and. (status .nes. "M")) .or. (ftp_status .nes. "Y")
What does .nes.
mean? equal? I've also seen .ne. , .eqs. too. What is the different of them?
Why are "and" and "or" surrounded by two dots? A DCL specific syntax?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
从内存中:
$ wo = "write sys$output"
正如你所说,将 wo 指定为“write sys$output”的别名,VMS 相当于 Unix stdout。.nes.
是“不等于字符串”,而.ne.
是数字“不等于”。正如您所猜测的,p1 是(第一个)参数。我不记得它是否从 p1 到 p9 或更多,或者是否没有任意限制。 p0 可能是程序名称,如 Python 的 sys.argv[0]。
命令过程最多接受 8 个参数,称为 P1 .. P8。
单引号 (') 插入以下变量名称,因此
wo "BILLING_RUN_NUMBER = ''billing_run_number'"
将输出,例如BILLING_RUN_NUMBER = '42'
(假设 p1)等于 42。我记不清当 DCL 看到这样的连续两个单引号时如何知道该怎么做......官方咒语是''symbol' 将实际的 DCL 文本替换为符号的值
,这至少可以让您开始...大多数使用 VMS 的商店在 3 环活页夹中都有数百磅的文档。四处询问。
from memory:
$ wo = "write sys$output"
is as you say, assigning wo as an alias for "write sys$output", VMS's equivalent to Unix stdout..nes.
is "not equal to string", compared to.ne.
which is a numeric "not equals".p1 is a (the first) parameter as you guessed. I can't remember if it goes p1 through p9, or more, or if there is no arbitrary limit. p0 might be the program name, like Python's sys.argv[0].
A command procedure accepts up to 8 parameters, called P1 .. P8.
a single quote (') interpolates the following variable name, so
wo "BILLING_RUN_NUMBER = ''billing_run_number'"
would output, for example,BILLING_RUN_NUMBER = '42'
, assuming p1 was equal to 42. I can't remember exactly how DCL knows what to do when it sees two single quotes in a row like that...The official incantation is ''symbol' to have the actual DCL text replaced by the value of symbol
that'll get you started at least... most shops that use VMS have a few hundred pounds of documentation in 3-ring binders. ask around.
除了上面引用的文档之外,还可以通过 HELP HINTS、HELP :=、HELP = 和 HELP @ 命令获得大量信息。我相信 P9-P16 随 OpenVMS V8.4 一起提供。
另外,请特别注意全局符号(使用双等号 {== 或 :==} 定义)和局部符号(使用单个等号 {= 或 :=} 定义)之间的区别。就像在区分大小写的语言中一样,定义的符号 A = 1 与定义的 A == 1 是不同的符号,并且本地符号可以屏蔽对全局符号的引用 - 也有一些命令如 READ 和 INQUIRE 可以创建符号,但我认为它们始终是本地符号 - 验证这一点,因为我是根据内存工作的。\
命令 SET SYMBOL /SCOPE[={LOCAL|NOLOCAL},{GLOBAL|NOGLOBAL}) 也会影响您是否可以看到某些类型的符号。
一般来说,尽可能保留局部符号 - 如果更高级别(调用)命令过程需要访问,或者如果返回交互式 DCL 时仍需要定义符号,则通常只需要全局符号 - 例外是任何程序您运行专门读取或写入或创建全局符号的程序 - 很少见,但我遇到过一些。
In addition to the documentation referenced above, there is also extensive information via the HELP HINTS, HELP :=, HELP =, and HELP @ commands. P9-P16 became available with OpenVMS V8.4, I believe.
Also, pay careful attention to the difference between global symbols (defined with a doubled equal sign {== or :==}) and local symbols (defined with a single equal sign {= or :=}). Like in case-sensitive languages a symbol defined A = 1 is a different symbol than one defined A == 1 and the local symbol can mask references to the global symbol - also some commands like READ and INQUIRE can create symbols, but I think they are always a local symbol - verify that since I'm working from memory.\
The command SET SYMBOL /SCOPE[={LOCAL|NOLOCAL},{GLOBAL|NOGLOBAL}) can also affect whether you can see certain types of symbols.
In general, stay with local symbols whenever you can - you usually only need a global symbol if a higher level (calling) command procedure needs access, or if you need the symbol still defined when you return to interactive DCL - the exception is any program that you run that specifically reads or write or creates a global symbol - rare, but I've run into a few.
您最多可以传递 8 个参数。每个参数都定义为 P1, P2... P8
如果您需要超过 8 个参数,您可以使用
@my_dcl "my_p1" "my_p2" "my_p3" "my_p4" "my_p5" "my_p6" "my_p7" "my_p8 这样的技巧my_p9 my_p10"
在
my_dcl
中,P8
将包含以下值“my_p8 my_p9 my_p10”在一个字符串中。单引号表示翻译字符串的内容。
所以,如果你定义
wo = "write sys$output"
你可以使用
或者
但是如果你想显示
write sys$output Hello World
如果你尝试,
你'会得到 wo
'wo Hello World!
因此,您必须用单引号将其引起来。
前两个是转义的单引号,最后一个表示停止翻译。
wo“‘wo’你好世界!”
与其他脚本语言一样,您可以拥有变量变量...
将打印 Hello world!
You can pass up to 8 parameters. Each one are defined as P1, P2... P8
If you need more than 8 parameters, you can use trick like
@my_dcl "my_p1" "my_p2" "my_p3" "my_p4" "my_p5" "my_p6" "my_p7" "my_p8 my_p9 my_p10"
In
my_dcl
,P8
will contain value of "my_p8 my_p9 my_p10" in one single string.The single quote means translate the content of the string.
So,if you define
wo = "write sys$output"
you can use
or
But what if you want to show
write sys$output Hello World
If you try,
you'll get wo
'wo Hello World!
So, you have to surround it with single quote.
The first two are a escaped single quote, the last one means to stop translation.
wo "''wo' Hello World!"
Like other script language, you can have variable variable...
will print Hello world!