Using the Caché ^%R Routine - InterSystems Documentation
Using the Caché ^%R Routine - InterSystems Documentation
Using the Caché ^%R Routine - InterSystems Documentation
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
LINESET<strong>^%R</strong><br />
; Change <strong>the</strong> namespace we will use<br />
Znspace "SAMPLES"<br />
; fill in <strong>the</strong> source code array<br />
Set N = 0<br />
Set code($INCREMENT(N)) = "AnExample ; An example routine"<br />
; Note leading spaces on <strong>the</strong> following entries"<br />
Set code($INCREMENT(N)) = " Write ""AnExample"", !"<br />
Set code($INCREMENT(N)) = " Quit"<br />
Set code(0) = N<br />
Set routine = "AnExample.INT"<br />
Set options = "S"<br />
Set errors = ""<br />
; Save<br />
; empty list<br />
; do it<br />
Set return = $$ROUTINE<strong>^%R</strong>(routine, .code, .errors, options)<br />
; show <strong>the</strong> simple result<br />
Write "Save result: ", return, !<br />
If (+return = "")<br />
{<br />
; format and display <strong>the</strong> errors<br />
Write $$FMTERR<strong>^%R</strong>(.errors, .code), !<br />
}<br />
Else<br />
{<br />
; remove local info<br />
Kill code<br />
; list <strong>the</strong> routine backwards<br />
For i = $$LENGTH<strong>^%R</strong>(routine) : -1 : 1<br />
{<br />
Write "Line ", i, ":: ", $$LINE<strong>^%R</strong>(routine, i), !<br />
}<br />
}<br />
; remove <strong>the</strong> saved source<br />
Write "Removing ", routine, ": ", $$DEL<strong>^%R</strong>(routine), !<br />
LINESET<strong>^%R</strong><br />
LINESET<strong>^%R</strong> (rtn, linenum, linetext)<br />
Parameters<br />
rtn<br />
linenum<br />
linetext<br />
The name of <strong>the</strong> target routine.<br />
The number of <strong>the</strong> line to be replaced or added.<br />
The contents of <strong>the</strong> new line.<br />
Description<br />
This function inserts <strong>the</strong> source text at <strong>the</strong> position indicated in <strong>the</strong> specified routine.<br />
<strong>Using</strong> <strong>the</strong> <strong>Caché</strong> <strong>^%R</strong> <strong>Routine</strong> 25