Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: AMQQCMPK

AMQQCMPK.m

Go to the documentation of this file.
AMQQCMPK ; IHS/CMI/THL - COMPILES OR GROUPS AND CHECKS SEARCH EFFICIENCY ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;-----
 I '$D(AMQQXX) W !,"Checking OR groups..."
 F AMQQKGNO=0:0 S AMQQKGNO=$O(^UTILITY("AMQQ OR",$J,1,AMQQKGNO)) Q:'AMQQKGNO  D ATNO,RUN,SET,LOC,RESET
EXIT K %,AMQQSER,AMQQISER,AMQQUATN,AMQQKONG,AMQQKGNO,AMQQKGAS,AMQQKGLA,AMQQKGLS,AMQQKGN,AMQQKGSN,AMQQNVAR,AMQQSVVR,AMQQVAR,G,I,Q,X,Y,Z,AMQT,AMQP,AMQQLINK,AMQQLINO,AMQQQ
 K ^UTILITY("AMQQ OR",$J)
 Q
 ;
ATNO S (AMQQKGAS,AMQQKGSN)=""
 F AMQQSER=-999:0 S AMQQSER=$O(^UTILITY("AMQQ",$J,"WEIGHT",AMQQSER)) Q:AMQQSER=""  F AMQQUATN=0:0 S AMQQUATN=$O(^UTILITY("AMQQ",$J,"WEIGHT",AMQQSER,AMQQUATN)) Q:'AMQQUATN  D INDEX
 Q
 ;
INDEX I '$D(^UTILITY("AMQQ OR",$J,1,AMQQKGNO,AMQQUATN)) Q
 S ^UTILITY("AMQQ OR",$J,2,AMQQKGNO,999-AMQQSER,AMQQUATN)=""
 I AMQQKGAS'="" S AMQQKGAS=AMQQKGAS_U
 S AMQQKGAS=AMQQKGAS_AMQQUATN
 S Y=0
 S X=1.9999
 F  S X=$O(^AMQQ(1,+^UTILITY("AMQQ",$J,"Q",AMQQUATN),X)) Q:'X  Q:X>2.999  S Y=Y+1
 I AMQQKGSN'="" S AMQQKGSN=AMQQKGSN_U
 S AMQQKGSN=AMQQKGSN_Y
 S AMQQKGLA=AMQQUATN
 Q
 ;
RUN S AMQQLINO=1
 S AMQQVAR=9
 F AMQQISER=0:0 S AMQQISER=$O(^UTILITY("AMQQ OR",$J,2,AMQQKGNO,AMQQISER)) Q:'AMQQISER  F AMQQUATN=0:0 S AMQQUATN=$O(^UTILITY("AMQQ OR",$J,2,AMQQKGNO,AMQQISER,AMQQUATN)) Q:'AMQQUATN  D CMP
 Q
 ;
CMP S Q=^UTILITY("AMQQ",$J,"Q",AMQQUATN)
 D TEMPLATE^AMQQCMP2
 Q
 ;
SET S %=""
 S Y=0
 F I=1:1 S X=$P(AMQQKGSN,U,I) S:'X AMQQKGLS=% Q:'X  S Y=Y+X S:%'="" %=%_U S %=%_Y
 S X=0,G="^UTILITY(""AMQQ OR"",$J,3)"
INCX S X=$O(AMQV(X))
 I 'X Q
 S %=+AMQQKGLS
 I X<% S @G@(X)=$S(+AMQQKGAS=AMQQKGLA:98,1:(%+1))_U_(X+1) G INCX
 S @G@(X)=$S(+AMQQKGAS=AMQQKGLA:98,1:X+1)_U_99
 S AMQQKGAS=$P(AMQQKGAS,U,2,99)
 S AMQQKGLS=$P(AMQQKGLS,U,2,99)
 G INCX
 ;
LOC F AMQQKGN=0:0 S AMQQKGN=$O(AMQV(AMQQKGN)) Q:'AMQQKGN  D TR
 S AMQV("OR",AMQQKGNO,98)="I 0"
 S AMQV("OR",AMQQKGNO,99)="I 1"
 S AMQV("OR",AMQQKGNO,0)="S %=AMQP(0) N AMQT,AMQP S AMQP(0)=% X AMQV(""OR"","_AMQQKGNO_",1)"
 Q
 ;
TR S %=^UTILITY("AMQQ OR",$J,3,AMQQKGN)
 S X="X AMQV(""OR"","_AMQQKGNO_",$S(AMQT("_AMQQKGN_"):"_$P(%,U,2)_",1:"_+%_"))"
 S AMQV("OR",AMQQKGNO,AMQQKGN)=$P(AMQV(AMQQKGN),"|30|")_X
 K AMQV(AMQQKGN)
 Q
 ;
RESET S AMQQKGFG=$O(^UTILITY("AMQQ OR",$J,1,AMQQKGNO,""))
 F X=-999:0 S X=$O(^UTILITY("AMQQ",$J,"WEIGHT",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"WEIGHT",X,Y)) Q:'Y  I $D(^UTILITY("AMQQ OR",$J,1,AMQQKGNO,Y)) K ^UTILITY("AMQQ",$J,"WEIGHT",X,Y),^UTILITY("AMQQ",$J,"Q",Y)
 S AMQQEXCD="S AMQP(0)=% N % X AMQV(""OR"",AMQQKGNO,1)"
 D KONG^AMQQATR
 S AMQQSER=X
 S ^UTILITY("AMQQ",$J,"WEIGHT",1-AMQQSER,AMQQKGFG)=""
 S ^UTILITY("AMQQ",$J,"Q",AMQQKGFG)="179^KONGLOMERATOR^K^^^^^^^^^^^1^"_AMQQKGNO
 K AMQQKGFG,AMQQECNT,AMQQEDEN,AMQQEINC,AMQQENUM,AMQQEXCD,AMQP,AMQT
 Q
 ;