In the terminal, I am printing the value of a global with zw ^MYGLOBAL
.
How do I save this output to a text file?
Asked
Active
Viewed 995 times
3
5 Answers
2
As you already mentioned yourself the easiest way to output global/local recursively is using ZWRITE
command. Output of which could be redirected if you OPEN
file and then USE
it, redirecting all write to principal device to this filename.
But as Sergey @SSH mentioned elsewhere, the better approach is to use %GO
utility (which essentially does the job similar to ZWRITE
but output of which could be read later using %GI
utility. If you want more effeciency in handling binary data then recomended approach is to output global(s) using %GOF
and read them back using %GIF
1
Another option is to use the ^%GO
utility. This way, you will be able to import your globals back with ^%GI
.
do ^%GO
-
Is there any way to run this as a single line and skip the interactive input? – syonip Nov 16 '15 at 10:07
-
No, not an easy way. For programmatic output it's better to use $system.OBJ.Export. – SSH Nov 17 '15 at 10:53
1
Not exactly a ZW format, but try
do $system.OBJ.Export("Global.GLB","backup.xml")
-
I'm getting the following error: "ERROR #6304: Unable to export item 'Global.GLB' because XML export does not support items of this type." – syonip Nov 18 '15 at 11:47
-