Written by

Systems Management Specialist
Question Pietro Montorfano · Feb 25, 2023

How to export all routines in individual files

Is there a way to do something like $SYSTEM.OBJ.ExportAllClassesIndividual() for the routines?

I'd like to export all routines in single files

Comments

Rod Fulton · Feb 25, 2023

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. 

0
Lorenzo Scalese · Feb 25, 2023

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"))
}
0
Dmitry Maslennikov · Feb 26, 2023

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

0
Enrico Parisi · Feb 26, 2023

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.

Enrico

0
John Murray · Feb 26, 2023

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

0
Pietro Montorfano  Feb 27, 2023 to John Murray

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

0
Timo Lindenschmid  Mar 3, 2023 to Pietro Montorfano

Hi Pietro,

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

0