• Uncategorized

About linux : Open-and-Read-a-File

Question Detail

Dears, I am working with YottaDB 1.32. I am trying to implement the program from:
https://www.youtube.com/watch?v=ObUAklaia1Y.
The code is the following:

 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

The errors that I get are the following:

 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

Can somebody explain me :

  1. What is a deviceparameter?. How can I find this issue?.

  2. The mtrees2003.txt and mesh.m are all in the same folder: ~/.yottadb/r1.32_x86_64/r. Is that important?.

  3. All the problems appear when I do YDB>zlink "mesh". But when I do YDB>do ^mesh, the only problem that appear is the YDB-E-DEVPARUNK.

Question Answer

M has some strange features, one of which is that even though the language is standardized, parts of the language (like the parameters for devices) are not.

I just checked, and it looks like you asked the question on comp.lang.mumps, and people already answered you. The correct answer is:

open "mtrees2003.txt":readonly

Take a look over here for documentation: https://docs.yottadb.com/ProgrammersGuide/ioproc.html#sequential-file-examples

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.