I created and then compiled a routine using the %Routine library
s routine = ##class(%Routine).%New(fileName_"."_extension)
d routine.Write(parsedRule)
//s status = routine.Save()
s status = routine.SaveStream(,.refresh)
if ($$$ISERR(status)) throw status