[613] | 1 | XPDRSUM ;SFISC/RWF - Routine checksum utilities ; 13 Oct 95 11:21
|
---|
| 2 | ;;8.0;KERNEL;**10**;Jul 10, 1995
|
---|
| 3 | Q
|
---|
| 4 | SUMA(GLO) ;This tag builds the old RSUM value
|
---|
| 5 | ;Call with a reference to a global that has the routine
|
---|
| 6 | N Y,%,%1,%2,%3 S Y=0
|
---|
| 7 | F %=1,3:1 S %1=$G(@GLO@(%,0)),%3=$F(%1," ") Q:'%3 S %3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*%2+Y
|
---|
| 8 | Q Y
|
---|
| 9 | SUMB(GLO) ;This tag builds the new RSUM value
|
---|
| 10 | ;Call with a reference to a global that has the routine
|
---|
| 11 | N Y,%,%1,%2,%3 S Y=0
|
---|
| 12 | F %=1,3:1 S %1=$G(@GLO@(%,0)),%3=$F(%1," ") Q:'%3 S %3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*(%2+%)+Y
|
---|
| 13 | Q Y
|
---|
| 14 | SUMC(GLO) ;This tag builds the new checksum for global
|
---|
| 15 | ;Call with a reference to a global
|
---|
| 16 | N Y,%,%1,%2,%3,%4,%5
|
---|
| 17 | S Y=0,%=$NA(@GLO),%1=$E(%,1,$L(%)-1),%2=$L(%1)
|
---|
| 18 | F %5=1:1 S GLO=$Q(@GLO) Q:GLO=""!($E(GLO,1,%2)'=%1) S %3=@GLO F %4=1:1:$L(%3) S Y=$A(%3,%4)*(%4+%5)+Y
|
---|
| 19 | Q Y
|
---|