Anna Golitsyna · Oct 8, 2021

Object script analog of RCOPY

I am trying to figure out the best ObjectScript analog to mimic, more or less, the %RCOPY functionality. What would be ObjectScript  method(s) if any to copy a routine from the current namespace to another one and compile it there?

Product version: Caché 2017.1
0 226
Discussion (12)2
Log in or sign up to continue

That would make the routine from namespace A immediately available in namespace B as is. The goal is to have routines in two namespaces different until the time comes for the programmer to make them the same via an RCOPY analog. It is also a "per routine" job used for synchronizing.

Thanks! Let's see if there are less "clunky" ways smiley

Marc, a slight variation on your idea, tested whether targetRtn exists or not. Thanks again!

zn "A"
zn "B"

What's bad about using %RCOPY if you want it ?

I think OP needs non-interactive approach.

Robert, it does not trigger source control and yes, I'd like it non-interactive too.

Also %RCOPY preserves date modified of the original routine, and I'd rather preserve it. So far other listed approaches do not preserve it.

Probably a bit old-fashioned and maybe too simple, but this still works:

x "zl @rtn zn tns zs @rtn"

where rtn is the routine name and tns contains the name of the 'to' namespace.

Yes, that works and assigns the time of copy as the date modified. Thanks, Stephen! BTW, in my experience at least some old-fashioned commands are faster than their modern equivalents though in this case the speed is not an issue.

That approach works only for *.INT routines. Don't you use *.MAC and *.INC as well?