InterSystems FAQ rubric
The ^%GCMP utility can be used to compare the contents of two globals.
For example, to compare ^test and ^test in the USER and SAMPLES namespaces, it would look like this:
*In the example below, 700 identical globals are created in the two namespaces, and the contents of one of them is changed to make it the detection target.
USER>kill ^test
USER>for i=1:1:100 { for j=1:1:7 { set ^test(i,j)="Test"_i } }
USER>zn "samples"
SAMPLES>kill ^test
SAMPLES>for i=1:1:100 { for j=1:1:7 { set ^test(i,j)="Test"_i } }
SAMPLES>set ^test(50,5,1)=1
SAMPLES>do ^%GCMP
Compare global ^test
on directory set: (this system)
in namespace: SAMPLES =>
with global ^test=>
on directory set: (this system)
in namespace: SAMPLES => USER
Output differences on
Device:
Right margin: 80 =>
Compare global ^test in SAMPLES
with global ^test in USER
^test(50,5,1) exists in ^|"SAMPLES"|test but not in ^|"USER"|test
Time=.001822
SAMPLES>
If you want to compare between instances on different servers, rather than within the same instance, use the ^DATACHECK utility. For instructions on how to use the ^DATACHECK utility, see the related article below:
How to compare multiple globals and routines in two databases