如何使用 BASICTYPE 'U' 在 Unidata 中进行定位对于@AM?
我通常在我们的商店使用 BASICTYPE“P”,但有一次在项目中使用“U”,并注意到我无法在由属性标记分隔的动态数组上进行定位。
参考文档,它明确指出在类型 U 中,不指定属性表达式是语法错误。对我来说,这似乎是一个巨大的疏忽。
如果不借助 for 循环来搜索这些项目,如何实现这一点呢?
I typically use BASICTYPE 'P' at our shop but had an occasion to use 'U' for a project and noticed that I could not do a locate on a dynamic array that is delimited by Attribute Marks.
Referencing the docs, it plainly states that in type U, not specifying an attribute expression is a syntax error. This seems like a huge oversight to me.
How would this be done without resorting to a for-loop to search for these items?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您的数组是由属性标记分隔的,则只需使用以下语法进行定位:
在值标记分隔的数组中进行定位有点棘手,如下所示:
If your array is delimited by attribute marks, you simply need to do your locate in the following syntax:
It's a bit trickier to locate within a value mark delimited array, which would be:
LOCATE 语句有两种形式
一种采用 Locate xxx in yyy 设置 zzz then aaa else bbb 的形式
另一个
定位(xxx;yyy;zzz) 然后 aaa else bbb
There are two forms of the LOCATE statement
One takes the form of Locate xxx in yyy setting zzz then aaa else bbb
and the other
Locate(xxx;yyy;zzz) then aaa else bbb
当处于 BASICTYPE 'U' 时,您可以使用 FIND 语句来代替。
来自手册:
语法
FIND expr IN dyn.array[,occurr] SETTING f [,v[,s]] {THEN 语句 | ELSE 语句}
描述
UniBasic FIND 命令确定给定表达式在
动态数组。 FIND 返回找到的属性、值和子值位置
细绳。表达式必须匹配整个数组元素才能构成匹配
When in BASICTYPE 'U', you could use the FIND statement instead.
From the manual:
Syntax
FIND expr IN dyn.array[,occur] SETTING f [,v[,s]] {THEN statements | ELSE statements}
Description
The UniBasic FIND command determines the position of the given expression in a
dynamic array. FIND returns the attribute, value, and subvalue position of the found
string. The expression must match the entire array element to make a matc