Hi,
I've recently started to set up a GTM environment on my linux box. I'm in the process of trying to back up some globals from my existing mumps environment to the GTM env.
Are there any docs or help that would allow me to accomplish this ?
I'm new at mumps as well as gtm. Helps and pointers would be greatly appreciated.
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The best way to move globals from other M implementations into GT.M is to extract them in GT.M's ZWR format and then to use GT.M's MUPIP LOAD function to load them into a GT.M database. A Cache program to extract globals from a Cache database can be found at http://sourceforge.net/tracker/index.php?func=detail&aid=605614&group_id=11026&atid=311026
It can probably be adapted to other M implementations.
To learn M, in addition to the GT.M Programmers Guide, I recommend Richard Walters' book, "M Programming: A Comprehensive Guide."
-- Bhaskar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-09-25
I'm having problems of getting backing up globals from other M implementation at the moment.
Also can you be more explanatory about GT.M ZWR format ? And where I can find out more about this ?
Thanks for your help.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, I can't help you with the other M implementation.
The GT.M ZWR format is used by GT.M for transmitting arbitrary data (including non printable, binary information). Essentially special characters are represented by their $C() values. The ZWR format is not explicitly documented, but it is easily generated and any M programmer will instantly recognize what it is when s/he sees it.
-- Bhaskar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
what other M implementation do you mean?
If it is Micronetics MSM, I think I can help you
Some versions of %GR can read MSM Globals directly
-- Martin
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-09-29
Hi,
The "other M implentation" i was mentioning was Chronicle.
I've managed to export a global from the system to a file .glo
I'm currently trying to see if I can import this .glo file to GT.M environment directly. I know Bhaskar mentioned of the ZWR format. I'm not sure if my .glo file is equivalent to the ZWR file mentioned. Please find attached a sample of the file.
Thanks.
======================================
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals")
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
M/SQL EXPORT FILE
Your format is not compatible with the ZWR format. It should be easy to write a small M program to convert this into ZWR format. However, what gets interesting is how the Chronicle format handles binary data.
I didn't realize there was an M implementation called Chronicle.
-- Bhaskar
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
From the dump you sent it looks like your implementation is probably Intersystems (M/SQL). Regardless, this is a very common format used to transport global data. Specifically, there are a number of header lines (which can be ignored by the loading program) and then pairs of lines of the form:
<global reference>
<data>
It is unlikely that the global contains binary data but if it does, as bhaskar has pointed out, there could be problems with this format.
Actually, the first line in your dump is actually code that will load the global data if you were to:
1) Open the file containing the data
2) Read the first line into a variable
3) Execute the contents of the variable.
Unfortunately, the line as sent was sort of truncated (probably did not wrap on your display). Further, this process is a bit complex and not all that portable. A much better solution exists.
The GT.M MUPIP utility will work just fine for loading this file. It will report a few errors on the header lines, and any other lines that do not correspond to the <global reference>/<data> pairing described above (these will probably be errors such as '"^" Expected"). To do this simply:
1) Transfer the file to the Linux system. Try to use a method that gets the end of line correct. (FTP ascii mode for example) Otherwise you can end up with extra CR characters if you are coming from a DOS/Windows type system.
2) Get your gtmgbldir variable set correctly as needed.
3) Simply use the "mupip load filename" command. Such as:
$ mupip load mydata.go
(the mupip executable should be in your path for the above to work) You should get an error for each header line except the first two but you can ignore those.
You could use "mupip load mydata.go -format=go" but the format seems to default fine.
Good Luck,
-bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-01
Bob,
Thanks for your help.
I've able to load the file into GT.M environment with the following errors (Please find attached at the end).
My questions are:
- is there something i need to set up for the database before importing ? It looks like the error is complaining that some data size is too big ?
- i've tried to perform a "w" (write) on the ER1 global after running the loading but it says that global ER1 is not defined. Should i be doing anything after performing the loading in order to access ER1 ?
Many thanks,
Tony
==========================
[root@localhost gtm]# mupip
MUPIP> LOAD test.glob -format=go
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals"" d object^%raimpn(A) u IO" F I=1:1 R A Q:A="" R B S @A=B I '(I#50) U 0 W "." U IO ;(Self-loading)
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
%GTM-E-NOTGBL, M/SQL EXPORT FILE
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-NOTGBL, definitions
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-NOTGBL, globals
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-REC2BIG, Record size (257) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 202",6330,99999,5)
Global variable : ^ER1("CAD"," 202",6330,99999,5)
%GTM-E-REC2BIG, Record size (257) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 202",6335,99999,7)
Global variable : ^ER1("CAD"," 202",6335,99999,7)
%GTM-E-REC2BIG, Record size (262) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 203",6335,99999,6)
Global variable : ^ER1("CAD"," 203",6335,99999,6)
%GTM-E-REC2BIG, Record size (267) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 203",6335,99999,7)
Global variable : ^ER1("CAD"," 203",6335,99999,7)
LOAD TOTAL Key Cnt: 28375 Max Subsc Len: 45 Max Data Len: 233
Last LOAD record number: 56765
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
First, most of your data probably loaded just fine. I suspect there were 28375 nodes loaded without problems. Assuming that the ^ER1 global was the only global in the file you can probably see the results by using the zwrite command. Try 'ZWRITE ^ER1' (no quotes). The output may be quite long but should be interruptible.
Second, it looks like you had a problem with four of the nodes because the data was (slightly) too long. This can be adjusted when you create the database file. The default block size is probably 512 bytes and GT.M limits the record size (which, I believe, includes the subscripts and the data) to about 1/2 this. I often use a 4K block size and a 2K record size. Unfortunately, you will need to backup your data, delete and recreate the database file, and then reload your data to change the block size.
Specifically, you can use the change command in GDE to change the block size and record size in your global directory file:
GDE> change -segment MYSEGNAME -block_size=4096
GDE> change -region MYREGIONNAME -record_size=2048
then delete the database file and recreate it with "mupip create". I would also do a "mupip rundown" before deleting the database file.
See the admin guide for additional details
Hope that Helps,
-bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-02
Bob,
What you've suggested worked well. I was able to import the global into the new GT.M environment.
I'm running into another mumps compile problem that might be a familiar thing to you:
- I'm trying to compile a few .m routines, namely NEWGX.m, NEWGX1.m, NEWGX2.m, etc ...
where from one routine there is a call to a function in another routine.
My question is that I don't know if there is something incompatible between different M environment ? Since the existing code is running find on Intersystems (M/SQL) environment.
Find below the sample codes and the errors.
Thanks again for the help.
in NEWGX1.m:
NEWGX1 ;; ; 03 Mar, 2003 1:03 PM
;;#lib#EALIB
;ASSEMBLES GLOBAL WITH DATA IN THE DESIRED FORMAT
CEDTYP D EDTYP^NEWGX2
S %B=$$eax(193,1)
S ^[DIR]XTEMP(unq,ID,%A,5)=%B ;reporting prov
S ^[DIR]XTEMP(unq,ID,%A,6)=^ER1(INI,ID,165,DAT,1) ;disease
S ^[DIR]XTEMP(unq,ID,%A,7)=$E(^ER1(INI,ID,115,99999,1),1,1) ;gender
S ^[DIR]XTEMP(unq,ID,%A,8)=$$dout(^ER1(INI,ID,100,99999,1),0) ;birthdate
in NEWGX2.m:
NEWGX2 ;; ; 26 Feb, 2003 10:16 AM
;;#lib#EALIB
EDTYP ;B "L+"
;EPISODE DATE TYPE AND DATE TYPE OTHER
S %D=^ER1(INI,ID,25,DAT,1),(%E,%C)=""
I %D=1 S %E=1
I %D=5 S %E=3,^[DIR]XTEMP(unq,ID,%A,19)=^[DIR]XTEMP(unq,ID,%A,3) lab test date
I %D=6 S %E=4
I %D=8 S %E=5
I %D=9 S %E=6
I "*2*3*4*7*97*99*"[%D S %E=9
I %E="" S %E=9,%C="Not Specified"
I %E=9&($D(^ER1(INI,ID,27,DAT,1))=1) S %C=^ER1(INI,ID,27,DAT,1)
I %E=9&(%C="DATE OF DIAGNOSIS") S %E=2,%C=""
I %E=9&(%D=2) S %C="Specimen collection date"
I %E=9&(%D=2&(^ER1(INI,ID,193,DAT,1)=53)) S %C="Encounter date"
I %E=9&(%D=3) S %C="Treatment date"
I %E=9&(%D=4) S %C="Specimen receipt date"
I %E=9&(%D=7) S %C="Today's Date"
I %E=9&(%D=97) S %C="Estimate"
S ^[DIR]XTEMP(unq,ID,%A,4)=%E
S ^[DIR]XTEMP(unq,ID,%A,50)=%C
Q
I got the following compile errors:
CEDTYP D EDTYP^NEWGX2
^-----
At column 22, line 8, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
S %B=$$eax(193,1)
^-----
At column 19, line 9, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
CAGE D AGE^NEWGX2
^-----
At column 18, line 14, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The code looks like it should compile just fine under GT.M.
I suspect that your problem is some sort of control character at the end of the lines you having trouble with. If it were a problem with all the lines I would suspect that a carriage return (control-M or hex 0x0D) character was at the end of every line. This commonly happens when moving text files to/from Unix/Dos systems.
However, it is a bit strange that you are only getting errors on these three lines. I assume you used %RO (or some other utility) to export the routines on a VMS(?) system. How did you actually move the routines and get them into individual files on the Linux system?
It does not look like your problem has anything to do with NEWGX2.m or calling between routines.
You might try looking at NEWGX1.m with a text editor and check the end of the line.
If you have the problem with all the ends of lines something like:
should be fairly safe and get rid of any carriage returns in the file.
Good Luck,
-bob
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-03
A mumps question for the expert:
I have this piece of code (please find attached). Can someone tells me what the line
nextID() n OK
means ? And if there is any relationship between nextID and nextID1 ?
Thanx.
===================
MBD ;MAIN ROUTINE
S ID="",DAT="",NEW=1
F S ID=$$nextID Q:ID="" D
. S DAT=1
. F S DAT=$O(^ER1(INI,ID,20,DAT)) Q:DAT="" D ^NEWGX1
D ^NEWGX3
Q
q ;;#eof#
Q ;;#eor#
nextID() n OK
nextID1 i 'NEW d i ID]"",ACCS'["G" s %(2)=$$znspace2(INI,ID) q ID
.i ALP="",LOW'?1A.ANP s ID=$$zoID(INI,ID) s:$$idgt(ID,HIH) ID="" q
.f s ID=$$znxNmID(INI,ANM,ID) s OK=1 d q:OK
..i ID="" s ANM=$$znxNm(INI,ANM) s:ANM]"" OK="" q
..i LOW'?1A.ANP,$$idgt(LOW,ID)!$$idgt(ID,HIH) s OK="" q
..i LOW?1A.ANP,LOW]ANM s OK="" q
..i LOW?1A.ANP,ANM]HIH s ID=""
i 'NEW,ID]"" d ^EASEC g:OK="" nextID1 s %(2)=$$znspace2(INI,ID) q ID
f d ^EANXT q:ACCS'["G"!(ID="") i ID]"" d ^EASEC q:OK
s NEW="",%(2)=$$znspace2(INI,ID) q ID ;;#eof#
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
"nextID()" is the line-label. The () is an empty formal parameter list. That is, this is an extrinsic function that takes no parameters. Look a few lines earlier where S ID=$$nextID invokes this function and stores the result in ID.
The "n OK" that follows the line-label is a NEW command, declaring that this function has a private local variable called OK.
The next line has a label nextID1 because code further down the function wants to GO to this line. Specifically:
g:OK="" nextID1
This instructs execution to GO to nextID1 when OK=""
Have you taken a look at Serenji, our syntax-coloring GUI editor and debugger that works with GT.M? A free 30-day eval can be downloaded from www.georgejames.com and you might find it helps you understand what code is doing.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-06
I've set up Serenji on my PC.
I've started SerenjiSentry on my PC to listen on default port 4321,''
How do i get my linux box where i'm running my M routines to connect to Serenji ?
Do I need to setup anything else on GT.M environment ?
Any helpers out there ?
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Tony
If you haven't already done so, you need to install a couple of server side routines. Start up Serenji and go to Help/task Guide and select "Loading the Server Side components" for detailed step-by-step instructions.
Once done, then you can connect to Serenji by issueing a command in your telnet session. There are a number of different options but I prefer to use the Serenji Shell:
GTM>d SHELL^%Serenji()
Serenji Shell, version 2.2.1
Job 1704, connected with user georgej on JOE at 127.0.0.1
Enter ? or press F1 for help
sGTM>
There's more information in the task guide "Debugging an interactive character mode application".
Any questions, please ask.
Regards
George
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-07
Another mumps related question:
If i have a global, say ^ER1, with all its nodes and child .... and i want to process through every record of this global, is there a way for me implement this in M ? If so, how?
Thanx.
An example taken out of an export file:
======================
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals"" d object^%raimpn(A) u IO" F I=1:1 R A Q:A="" R B S @A=B I '(I#50) U 0 W "." U IO ;(Self-loading)
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
M/SQL EXPORT FILE
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Anonymous
-
2003-10-08
I wrote this piece of M code to traverse through my global, ER1. From Serenji debug, it seemed that after my first FOR loop, iniDB never get set to anything.
If I actually do a S iniDB=$O(^ER1(iniDB)), then i get a value.
Can someone tell me why this is ?
And the following error were observed on the server side:
sGTM>d ^Test
150373498,Test+8^Test,%GTM-E-NULSUBSC, Null subscripts are not allowed for region: DEFAULT,%GTM-I-GVIS, Global variable: ^ER1("","")
Thanks.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
$Query would probably be your preferred export mechanism:
S QQ=$NA(^ER1) F S QQ=$Q(@QQ) Q:QQ="" W !,QQ,!,@QQ
Would write out every node in ^ER1, along with its value on alternating lines, so:
F R GLO,VAL S @GLO=VAL
would read them back in/set them (the ending conditions/flags and selecting the right device are left to your experimentation).
The above presumes that ^ER1 does not have control characters in either its subscripts or values (which would, potentially, make the reads terminate at the wrong point).
Ben
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In GT.M, you can use $zdate to convert internal date/time to the date and/or time formatted based on your argument. For example,
GTM>w $zd("59453","MON-DD-YEAR")
OCT-11-2003
GTM>
For the detailed usage and format of $zdate, please refer to GT.M Programmer's Guide.
Hope this helps.
-- Chunling.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I've recently started to set up a GTM environment on my linux box. I'm in the process of trying to back up some globals from my existing mumps environment to the GTM env.
Are there any docs or help that would allow me to accomplish this ?
I'm new at mumps as well as gtm. Helps and pointers would be greatly appreciated.
Thanks.
The best way to move globals from other M implementations into GT.M is to extract them in GT.M's ZWR format and then to use GT.M's MUPIP LOAD function to load them into a GT.M database. A Cache program to extract globals from a Cache database can be found at http://sourceforge.net/tracker/index.php?func=detail&aid=605614&group_id=11026&atid=311026
It can probably be adapted to other M implementations.
To learn M, in addition to the GT.M Programmers Guide, I recommend Richard Walters' book, "M Programming: A Comprehensive Guide."
-- Bhaskar
I'm having problems of getting backing up globals from other M implementation at the moment.
Also can you be more explanatory about GT.M ZWR format ? And where I can find out more about this ?
Thanks for your help.
Unfortunately, I can't help you with the other M implementation.
The GT.M ZWR format is used by GT.M for transmitting arbitrary data (including non printable, binary information). Essentially special characters are represented by their $C() values. The ZWR format is not explicitly documented, but it is easily generated and any M programmer will instantly recognize what it is when s/he sees it.
-- Bhaskar
Hello Tony,
what other M implementation do you mean?
If it is Micronetics MSM, I think I can help you
Some versions of %GR can read MSM Globals directly
-- Martin
Hi,
The "other M implentation" i was mentioning was Chronicle.
I've managed to export a global from the system to a file .glo
I'm currently trying to see if I can import this .glo file to GT.M environment directly. I know Bhaskar mentioned of the ZWR format. I'm not sure if my .glo file is equivalent to the ZWR file mentioned. Please find attached a sample of the file.
Thanks.
======================================
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals")
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
M/SQL EXPORT FILE
definitions
globals
^ER1("CAC"," 1",10,67088,1)
54443
^ER1("CAC"," 1",20,67088,1)
1
^ER1("CAC"," 1",100,99999,0)
182
^ER1("CAC"," 1",100,99999,1)
1
^ER1("CAC"," 1",100,99999,2)
2
^ER1("CAC"," 1",100,99999,3)
3
^ER1("CAC"," 1",100,99999,4)
4
^ER1("CAC"," 1",100,99999,5)
Your format is not compatible with the ZWR format. It should be easy to write a small M program to convert this into ZWR format. However, what gets interesting is how the Chronicle format handles binary data.
I didn't realize there was an M implementation called Chronicle.
-- Bhaskar
Tony:
From the dump you sent it looks like your implementation is probably Intersystems (M/SQL). Regardless, this is a very common format used to transport global data. Specifically, there are a number of header lines (which can be ignored by the loading program) and then pairs of lines of the form:
<global reference>
<data>
It is unlikely that the global contains binary data but if it does, as bhaskar has pointed out, there could be problems with this format.
Actually, the first line in your dump is actually code that will load the global data if you were to:
1) Open the file containing the data
2) Read the first line into a variable
3) Execute the contents of the variable.
Unfortunately, the line as sent was sort of truncated (probably did not wrap on your display). Further, this process is a bit complex and not all that portable. A much better solution exists.
The GT.M MUPIP utility will work just fine for loading this file. It will report a few errors on the header lines, and any other lines that do not correspond to the <global reference>/<data> pairing described above (these will probably be errors such as '"^" Expected"). To do this simply:
1) Transfer the file to the Linux system. Try to use a method that gets the end of line correct. (FTP ascii mode for example) Otherwise you can end up with extra CR characters if you are coming from a DOS/Windows type system.
2) Get your gtmgbldir variable set correctly as needed.
3) Simply use the "mupip load filename" command. Such as:
$ mupip load mydata.go
(the mupip executable should be in your path for the above to work) You should get an error for each header line except the first two but you can ignore those.
You could use "mupip load mydata.go -format=go" but the format seems to default fine.
Good Luck,
-bob
Bob,
Thanks for your help.
I've able to load the file into GT.M environment with the following errors (Please find attached at the end).
My questions are:
- is there something i need to set up for the database before importing ? It looks like the error is complaining that some data size is too big ?
- i've tried to perform a "w" (write) on the ER1 global after running the loading but it says that global ER1 is not defined. Should i be doing anything after performing the loading in order to access ER1 ?
Many thanks,
Tony
==========================
[root@localhost gtm]# mupip
MUPIP> LOAD test.glob -format=go
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals"" d object^%raimpn(A) u IO" F I=1:1 R A Q:A="" R B S @A=B I '(I#50) U 0 W "." U IO ;(Self-loading)
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
%GTM-E-NOTGBL, M/SQL EXPORT FILE
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-NOTGBL, definitions
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-NOTGBL, globals
"^" Expected
Global variable : ^(-000000000000000000000000000000000000000000000000000000000)
%GTM-E-REC2BIG, Record size (257) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 202",6330,99999,5)
Global variable : ^ER1("CAD"," 202",6330,99999,5)
%GTM-E-REC2BIG, Record size (257) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 202",6335,99999,7)
Global variable : ^ER1("CAD"," 202",6335,99999,7)
%GTM-E-REC2BIG, Record size (262) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 203",6335,99999,6)
Global variable : ^ER1("CAD"," 203",6335,99999,6)
%GTM-E-REC2BIG, Record size (267) is greater than maximum (256) for region: DEFAULT
%GTM-I-GVIS, Global variable: ^ER1("CAD"," 203",6335,99999,7)
Global variable : ^ER1("CAD"," 203",6335,99999,7)
LOAD TOTAL Key Cnt: 28375 Max Subsc Len: 45 Max Data Len: 233
Last LOAD record number: 56765
Tony:
First, most of your data probably loaded just fine. I suspect there were 28375 nodes loaded without problems. Assuming that the ^ER1 global was the only global in the file you can probably see the results by using the zwrite command. Try 'ZWRITE ^ER1' (no quotes). The output may be quite long but should be interruptible.
Second, it looks like you had a problem with four of the nodes because the data was (slightly) too long. This can be adjusted when you create the database file. The default block size is probably 512 bytes and GT.M limits the record size (which, I believe, includes the subscripts and the data) to about 1/2 this. I often use a 4K block size and a 2K record size. Unfortunately, you will need to backup your data, delete and recreate the database file, and then reload your data to change the block size.
Specifically, you can use the change command in GDE to change the block size and record size in your global directory file:
GDE> change -segment MYSEGNAME -block_size=4096
GDE> change -region MYREGIONNAME -record_size=2048
then delete the database file and recreate it with "mupip create". I would also do a "mupip rundown" before deleting the database file.
See the admin guide for additional details
Hope that Helps,
-bob
Bob,
What you've suggested worked well. I was able to import the global into the new GT.M environment.
I'm running into another mumps compile problem that might be a familiar thing to you:
- I'm trying to compile a few .m routines, namely NEWGX.m, NEWGX1.m, NEWGX2.m, etc ...
where from one routine there is a call to a function in another routine.
My question is that I don't know if there is something incompatible between different M environment ? Since the existing code is running find on Intersystems (M/SQL) environment.
Find below the sample codes and the errors.
Thanks again for the help.
in NEWGX1.m:
NEWGX1 ;; ; 03 Mar, 2003 1:03 PM
;;#lib#EALIB
;ASSEMBLES GLOBAL WITH DATA IN THE DESIRED FORMAT
CEDTYP D EDTYP^NEWGX2
S %B=$$eax(193,1)
S ^[DIR]XTEMP(unq,ID,%A,5)=%B ;reporting prov
S ^[DIR]XTEMP(unq,ID,%A,6)=^ER1(INI,ID,165,DAT,1) ;disease
S ^[DIR]XTEMP(unq,ID,%A,7)=$E(^ER1(INI,ID,115,99999,1),1,1) ;gender
S ^[DIR]XTEMP(unq,ID,%A,8)=$$dout(^ER1(INI,ID,100,99999,1),0) ;birthdate
in NEWGX2.m:
NEWGX2 ;; ; 26 Feb, 2003 10:16 AM
;;#lib#EALIB
EDTYP ;B "L+"
;EPISODE DATE TYPE AND DATE TYPE OTHER
S %D=^ER1(INI,ID,25,DAT,1),(%E,%C)=""
I %D=1 S %E=1
I %D=5 S %E=3,^[DIR]XTEMP(unq,ID,%A,19)=^[DIR]XTEMP(unq,ID,%A,3) lab test date
I %D=6 S %E=4
I %D=8 S %E=5
I %D=9 S %E=6
I "*2*3*4*7*97*99*"[%D S %E=9
I %E="" S %E=9,%C="Not Specified"
I %E=9&($D(^ER1(INI,ID,27,DAT,1))=1) S %C=^ER1(INI,ID,27,DAT,1)
I %E=9&(%C="DATE OF DIAGNOSIS") S %E=2,%C=""
I %E=9&(%D=2) S %C="Specimen collection date"
I %E=9&(%D=2&(^ER1(INI,ID,193,DAT,1)=53)) S %C="Encounter date"
I %E=9&(%D=3) S %C="Treatment date"
I %E=9&(%D=4) S %C="Specimen receipt date"
I %E=9&(%D=7) S %C="Today's Date"
I %E=9&(%D=97) S %C="Estimate"
S ^[DIR]XTEMP(unq,ID,%A,4)=%E
S ^[DIR]XTEMP(unq,ID,%A,50)=%C
Q
I got the following compile errors:
CEDTYP D EDTYP^NEWGX2
^-----
At column 22, line 8, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
S %B=$$eax(193,1)
^-----
At column 19, line 9, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
CAGE D AGE^NEWGX2
^-----
At column 18, line 14, source module /root/gtm/routines/NEWGX1.m
%GTM-E-SPOREOL, Either a space or an end-of-line was expected but not found
Tony:
The code looks like it should compile just fine under GT.M.
I suspect that your problem is some sort of control character at the end of the lines you having trouble with. If it were a problem with all the lines I would suspect that a carriage return (control-M or hex 0x0D) character was at the end of every line. This commonly happens when moving text files to/from Unix/Dos systems.
However, it is a bit strange that you are only getting errors on these three lines. I assume you used %RO (or some other utility) to export the routines on a VMS(?) system. How did you actually move the routines and get them into individual files on the Linux system?
It does not look like your problem has anything to do with NEWGX2.m or calling between routines.
You might try looking at NEWGX1.m with a text editor and check the end of the line.
If you have the problem with all the ends of lines something like:
$ tr -d '\r' <NEWGX1.m >temp.m
$ mumps temp.m
$ mv temp.m NEWGX1.m
$ mumps NEWGX1.m
should be fairly safe and get rid of any carriage returns in the file.
Good Luck,
-bob
A mumps question for the expert:
I have this piece of code (please find attached). Can someone tells me what the line
nextID() n OK
means ? And if there is any relationship between nextID and nextID1 ?
Thanx.
===================
MBD ;MAIN ROUTINE
S ID="",DAT="",NEW=1
F S ID=$$nextID Q:ID="" D
. S DAT=1
. F S DAT=$O(^ER1(INI,ID,20,DAT)) Q:DAT="" D ^NEWGX1
D ^NEWGX3
Q
q ;;#eof#
Q ;;#eor#
nextID() n OK
nextID1 i 'NEW d i ID]"",ACCS'["G" s %(2)=$$znspace2(INI,ID) q ID
.i ALP="",LOW'?1A.ANP s ID=$$zoID(INI,ID) s:$$idgt(ID,HIH) ID="" q
.f s ID=$$znxNmID(INI,ANM,ID) s OK=1 d q:OK
..i ID="" s ANM=$$znxNm(INI,ANM) s:ANM]"" OK="" q
..i LOW'?1A.ANP,$$idgt(LOW,ID)!$$idgt(ID,HIH) s OK="" q
..i LOW?1A.ANP,LOW]ANM s OK="" q
..i LOW?1A.ANP,ANM]HIH s ID=""
i 'NEW,ID]"" d ^EASEC g:OK="" nextID1 s %(2)=$$znspace2(INI,ID) q ID
f d ^EANXT q:ACCS'["G"!(ID="") i ID]"" d ^EASEC q:OK
s NEW="",%(2)=$$znspace2(INI,ID) q ID ;;#eof#
"nextID()" is the line-label. The () is an empty formal parameter list. That is, this is an extrinsic function that takes no parameters. Look a few lines earlier where S ID=$$nextID invokes this function and stores the result in ID.
The "n OK" that follows the line-label is a NEW command, declaring that this function has a private local variable called OK.
The next line has a label nextID1 because code further down the function wants to GO to this line. Specifically:
g:OK="" nextID1
This instructs execution to GO to nextID1 when OK=""
Have you taken a look at Serenji, our syntax-coloring GUI editor and debugger that works with GT.M? A free 30-day eval can be downloaded from www.georgejames.com and you might find it helps you understand what code is doing.
I've set up Serenji on my PC.
I've started SerenjiSentry on my PC to listen on default port 4321,''
How do i get my linux box where i'm running my M routines to connect to Serenji ?
Do I need to setup anything else on GT.M environment ?
Any helpers out there ?
Thanks.
Tony
If you haven't already done so, you need to install a couple of server side routines. Start up Serenji and go to Help/task Guide and select "Loading the Server Side components" for detailed step-by-step instructions.
Once done, then you can connect to Serenji by issueing a command in your telnet session. There are a number of different options but I prefer to use the Serenji Shell:
GTM>d SHELL^%Serenji()
Serenji Shell, version 2.2.1
Job 1704, connected with user georgej on JOE at 127.0.0.1
Enter ? or press F1 for help
sGTM>
There's more information in the task guide "Debugging an interactive character mode application".
Any questions, please ask.
Regards
George
Another mumps related question:
If i have a global, say ^ER1, with all its nodes and child .... and i want to process through every record of this global, is there a way for me implement this in M ? If so, how?
Thanx.
An example taken out of an export file:
======================
N A,B,I,IO S IO=$I U IO R A,B U 0 W !,A,!,B U IO R A,B X "F R A Q:A=""globals"" d object^%raimpn(A) u IO" F I=1:1 R A Q:A="" R B S @A=B I '(I#50) U 0 W "." U IO ;(Self-loading)
EXPORT GLOBALS - Sep 26, 2003 - 02:33PM
M/SQL EXPORT FILE
definitions
globals
^ER1("CAC"," 1",10,67088,1)
54443
^ER1("CAC"," 1",20,67088,1)
1
^ER1("CAC"," 1",100,99999,0)
182
^ER1("CAC"," 1",100,99999,1)
1
^ER1("CAC"," 1",100,99999,2)
2
^ER1("CAC"," 1",100,99999,3)
3
^ER1("CAC"," 1",100,99999,4)
4
To process all the records in your global, you could use a for loop and the $ORDER function, e.g.
Set X=""
For Set X=$O(^ER1(X)) quit:X="" do
. ;process record
. ...
Hope this helps
Sade
You could also use $QUERY to traverse the entire global, e.g.
GTM>s x="^ER1"
GTM>f s x=$Q(@x) q:x="" w !,x
^ER1("CAC"," 1",20,67088,1)
^ER1("CAC"," 1",100,99999,0)
^ER1("CAC"," 1",100,99999,1)
^ER1("CAC"," 1",100,99999,2)
^ER1("CAC"," 1",100,99999,3)
^ER1("CAC"," 1",100,99999,4)
Hope it helps
Sade
I wrote this piece of M code to traverse through my global, ER1. From Serenji debug, it seemed that after my first FOR loop, iniDB never get set to anything.
If I actually do a S iniDB=$O(^ER1(iniDB)), then i get a value.
Can someone tell me why this is ?
And the following error were observed on the server side:
sGTM>d ^Test
150373498,Test+8^Test,%GTM-E-NULSUBSC, Null subscripts are not allowed for region: DEFAULT,%GTM-I-GVIS, Global variable: ^ER1("","")
Thanks.
$Query would probably be your preferred export mechanism:
S QQ=$NA(^ER1) F S QQ=$Q(@QQ) Q:QQ="" W !,QQ,!,@QQ
Would write out every node in ^ER1, along with its value on alternating lines, so:
F R GLO,VAL S @GLO=VAL
would read them back in/set them (the ending conditions/flags and selecting the right device are left to your experimentation).
The above presumes that ^ER1 does not have control characters in either its subscripts or values (which would, potentially, make the reads terminate at the wrong point).
Ben
For export from Cache for import into GT.M, including the ability to export binary data, Maury Pepper has submitted code at http://sourceforge.net/tracker/index.php?func=detail&aid=534145&group_id=11026&atid=311026
Maury's code is probably easily adapted to other M implementations.
-- Bhaskar
Does anyone knows how to convert a M internal date in the format ddddd (where ddddd is the number of days since 12/31/1841) into a readable form ?
Thanks.
In GT.M, you can use $zdate to convert internal date/time to the date and/or time formatted based on your argument. For example,
GTM>w $zd("59453","MON-DD-YEAR")
OCT-11-2003
GTM>
For the detailed usage and format of $zdate, please refer to GT.M Programmer's Guide.
Hope this helps.
-- Chunling.