文章 Nicky Zhu · 十月 28 2m read

如何比较两个全局变量的内容

InterSystems 常见问题解答标题

^%GCMP 实用工具可用于比较两个全局变量的内容。

例如,要比较 USER 和 SAMPLES 命名空间中的 ^test 和 ^test,过程将与下面类似:
*以下示例在这两个命名空间中创建了 700 个相同的全局变量,并更改了其中一个的内容,使其成为检测目标。

USER>kill^test
USER>for i=1:1:100 { forj=1:1:7 { set^test(i,j)="Test"_i } }

USER>zn"samples"// change namespace to SAMPLES SAMPLES>kill^test SAMPLES>for i=1:1:100 { forj=1:1:7 { set^test(i,j)="Test"_i } }

SAMPLES>set^test(50,5,1)=1// Change one of the globals created in the SAMPLES namespace. SAMPLES>do^%GCMP Compare global ^test// Global to compare. on directory set: (this system) // Enter in namespace: SAMPLES => // Enter (if this namespace is OK) with global ^test=> // Global to compare on directory set: (this system) // Enter in namespace: SAMPLES => USER // Namespace to compare Output differences on Device: // Destination for output results. Press <Enter> to view in a terminal.// If you enter the full path of the log file name, the output will be sent there. 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 // Detects differing globals Time=.001822 SAMPLES>

如果要在不同服务器上的实例之间进行比较,而不是在同一实例中,请使用 ^DATACHECK 实用工具。 有关如何使用 ^DATACHECK 实用工具的说明,请参阅以下相关文章:

如何比较两个数据库中的多个全局变量和例程