Dears,
I am trying to implement the program from: https://www.youtube.com/watch?v=ObUAklaia1Y.
But, I have the following problem:
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
The code was:
kill ^mesh
open 1:"mtrees.m,old"
if '$test write "mtrees2003.m not found",in,! halt
Any suggestions?
Since this code was intended as a teaching example, I'd change it for the following reasons:
- use meaningful variable names
- do not use single character variable names
- do not use HALT unless there is a severe error, use QUIT to go back to the calling program
- use the USE command close to the READ or WRITE that it is associated with
- do not use unnecessary intermediate arrays
- do not use multiple loops when a single one is all you need
- I just prefer to use $Principal rather than a platform-specific device number, although both work the same in all implementations that I know of
Which gives me:
Meshtree ;
kill ^mesh
set filename="mtrees2003.txt"
open filename:(readonly:exception="write "_filename_"" not found"" halt")
for use filename quit:$zeof read line do
. set key=$piece(line,";",1) ; text description
. set code=$piece(line,";",2) ; list of codes
. if (key="")!(code="") quit
. set command="Set ^mesh",separator="("
. for ii=1:1 Set part=$piece(code,".",ii) Quit:part="" Set command=command_separator_""""_part_"""",separator=","
. set command=command_")="""_key_""""
.;
.;#-----------------------------------------------------------------------
.;# command now looks like set ^mesh("A01","047")="Abdomen"
.;# now execute the text
.;#-----------------------------------------------------------------------
.;
. use $principal write command,!
. xecute command
;
close filename
use $principal write "done",!
quit
(And of course, the code assumes that neither the mesh-codes, nor the key values contain any occurrences of the character " (quote, sometimes called double quote)...)
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 285 |
Nodes: | 16 (2 / 14) |
Uptime: | 62:03:58 |
Calls: | 6,488 |
Calls today: | 1 |
Files: | 12,096 |
Messages: | 5,274,518 |