【问题标题】:Open and Read a File打开并读取文件
【发布时间】:2022-01-03 12:49:48
【问题描述】:

亲爱的,我正在使用 YottaDB 1.32。我正在尝试从以下位置实施该程序: https://www.youtube.com/watch?v=ObUAklaia1Y。 代码如下:

 kill ^mesh
 open 1:"mtrees.m,old"
 if '$test write "mtrees2003.m not found",in,! halt
 for  use 1 read a quit:'$test  do
 . set key=$piece(a,":",1) ;text description
 . set code=$piece(a,":",2) ;everything else
; extract code numbers
 . for i=1:1 set x(i)=$piece(code,".",i) quit:x(i)=""
 . set i=i-1
 . use 5
; begin building a global reference
 . set z="^mesh("
;-----------------------------------------------------------
; build a reference like ^mesh("A01","047","025","600")
; by concatenating quotes, codes, quotes, and commas onto z
;-----------------------------------------------------------
 . for j=1:1:i-1 zet z=z_ """"_x(j)_ ""","
 . set z="set "_z_""""_x(i)_""")"_key_""""
;-----------------------------------------------------------
; z now looks like set ^mesh("A01","047")="Abdomen"
; now executes the next
;-----------------------------------------------------------
 . write z,!
 . xecute z
 close 1

我得到的错误如下:

 open 1:"mtrees2003.m,old"
                ^-----
                At column 9, line 2, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-E-DEVPARUNK, Deviceparameter unknown
         . for i=1:1 set x(i)=$piece(code,".",i) quit:x(i)=""
           ^-----
                At column 4, line 8, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . set i=i-1
           ^-----
                At column 4, line 9, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . use 5
           ^-----
                At column 4, line 10, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . set z="^mesh("
           ^-----
                At column 4, line 12, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . for j=1:1:i-1 zet z=z_ """"_x(j)_ ""","
           ^-----
                At column 4, line 17, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . set z="set "_z_""""_x(i)_""")"_key_""""
           ^-----
                At column 4, line 18, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . write z,!
           ^-----
                At column 4, line 23, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep
         . xecute z
           ^-----
                At column 4, line 24, source module /home/test/.yottadb/r1.32_x86_64/r/mesh.m
%YDB-W-BLKTOODEEP, Block level too deep

谁能给我解释一下:

  1. 什么是设备参数?我怎样才能找到这个问题?。

  2. mtrees2003.txt 和 mesh.m 都在同一个文件夹中:~/.yottadb/r1.32_x86_64/r。这很重要吗?

  3. 当我YDB>zlink "mesh" 时,所有问题都会出现。但是当我执行YDB>do ^mesh 时,出现的唯一问题是 YDB-E-DEVPARUNK。

【问题讨论】:

    标签: linux editor mumps


    【解决方案1】:

    M 有一些奇怪的特性,其中之一是即使语言是标准化的,但部分语言(如设备的参数)不是。

    我刚刚查了一下,看起来你在 comp.lang.mumps 上提出了这个问题,而且人们已经回答了你。正确答案是:

    open "mtrees2003.txt":readonly
    

    在这里查看文档:https://docs.yottadb.com/ProgrammersGuide/ioproc.html#sequential-file-examples

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-09
      • 2011-05-11
      • 2019-07-11
      • 1970-01-01
      • 2012-09-29
      • 1970-01-01
      相关资源
      最近更新 更多