Discussion (7)3
Log in or sign up to continue

Good afternoon Pietro,

Try %RO. It's "Routine Out". Enter at the command line "D ^%RO" and just follow the prompts. This is a systems routine that's been a staple of Intersystems since forever and was there in 2021. Good luck. PLEASE IGNORE THE PREVIOUS PART OF MY POST - I misunderstood what you wanted to do. I thought you wanted one single file for all the routines, not individual files for each routine. %RO will let you do individual files for each routine but you'll have to specify each individual routine and the file it should be written to. It will work for MAC and INT files but I'm not sure about anything else. It seems to me that some of the other solutions proposed by others will do what you want. However, it all you want are MAC routines and INT routines you could write a small quick and dirty routine to do that. 

Hello @Pietro Montorfano 

You can try to write your own export method.
Using %Library.RoutineIndex looks good.  Example to export all ".MAC" :

set tRes = ##class(%SQL.Statement).%ExecDirect(.tStmt,"select name||'.'||type as itemName  from %Library.RoutineIndex where type = ? and $Extract(name,1) <> '%'","MAC")
While tRes.%Next() {
	Do $SYSTEM.OBJ.ExportUDL(tRes.%Get("itemName"),"<dir>/"_tRes.%Get("itemName"))

At least you can use VSCode for this task, routines and classes and even some other types 

Ciao Pietro,

there are 2 cases for routines, INT and MAC.

INT are generated when MAC is compiled but may also be written directly ("old style"), so I'd use:

do $system.OBJ.Export("*.mac,*.int","c:\temp\myexport.xml","/generated=0")

This way you export all INT and MAC but exclude generated INT.


Can you help us understand why you want each routine exported into its own separate file? 

diff between 2 environment made easy.

Have i ported all routines from env A to env B?

Are they the same?

Exporting everything in a single file allow you to use something like winmerge and make a full diff

Hi Pietro,

if you got access try doing a BaselineExport using %Studio.SourceControl.ISC:BaselineExport