· Jan 25, 2017

What is the easiest way to include an INCLUDE at the beginning of each MAC routine

I am in the planning stages of making things more uniform in our routines and I would like to know what the easiest way would be to include an .inc at the beginning of each .mac routine. Has anyone written something that would open all routines and place something into the first row while leaving the rest of the routine unchanged? Thanks for any guidance you all may provide.

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


You can do a routine for to do it, for example:

set rou=""
for {
  set rou=$o(^rMAC(rou)) quit:rou=""

  write !,rou
  set lines=^rMAC(rou,0,0)

  for x=lines:-1:2 {
    set ^rMAC(rou,0,x+1)=^rMAC(rou,0,x)
  set ^rMAC(rou,0,2)=$c(9)_"#include %occInclude"
  set ^rMAC(rou,0,0)=lines+1
  set ^rMAC(rou,0)=$now()

  do COMPILE^%RCOMPIL(rou,"MAC",.success)