Question
Rustam Ibragimov · Jul 15, 2016

How to write into Cache classes, routines etc

Hello, guys.

I have an external file that contains data in UDL format(as in Studio, not XML) and I need to somehow overwrite my source file with that file. 

I tried to use this snippet for .mac file

 set rtn = ##class(%RoutineMgr).%OpenId("les.mac")
 rtn.Code.WriteLine("some text")

It says that status is 1, but I don't see any difference in my source file.

Is there any way to overwrite source files, not only .mac but .cls, .int, .dfi?

2
0 506
Discussion (4)2
Log in or sign up to continue

I haven't done this before, but I am pretty sure you have to call %Save in order to apply your changes.

It's a right way, but don't you think, that you forgot to save your changes ? something like this

w rtn.%Save()

or you can just use $system.OBJ.Load("les.mac") or $system.OBJ.Load("some.class.cls") in versions 2016.2+
if you have less version but not less then 2014.1, you can load class with %Compiler.UDL.TextServices  as I've already offered to use it for export on stackoverflow