AMQQF1 ; IHS/CMI/THL - MORE ANALYTIC FUNCTIONS ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;-----
TEST N T
S T=$T
I '$D(AMQQNOT)=T K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)
EXIT Q
;
COMP S X1=Z
S X2=$P(AMQQCOMP,";")
D C^%DTC
S A=X
S X1=Z
S X2=$P(AMQQCOMP,";",2)
D C^%DTC
S B=X
Q
;
CDOB N X,Y,Z,%,I,A,B
S Z=$P(^DPT(AMQP(0),0),U,3)
I Z D COMP
F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I S Y=$P(^(I),U,2) D CDOB1,TEST
K AMQQNOT
Q
;
CDOB1 I Z="" Q
I Y<A!(Y>B)
Q
;
CDOD N X,Y,Z,%,I,A,B
S Z=""
I $D(^DPT(AMQP(0),.35)) S Z=+^(.35) I Z D COMP
F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I S Y=$P(^(I),U,2) D CDOD1,TEST
K AMQQNOT
Q
;
CDOD1 I Z="" Q
I Y<B!(Y>A)
Q
;
CAGE N X,Y,Z,%,I,A,B
S X1=$P(^DPT(AMQP(0),0),U,3)
I X1="" K X1 S Z="" G CAGET
S X2=$P(AMQQCOMP,";",4)
D C^%DTC
S Z=X
D COMP
CAGET F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I S Y=$P(^(I),U,2) D CAGE1,TEST
K AMQQNOT
Q
;
CAGE1 I Z="" Q
I Y<A!(Y>B)
Q
;
SUB N AMQQSQFS,AMQQSQFN,AMQQSQFP,I
S AMQQSQFS=$P(AMQQCOMP,";")
S AMQQSQFN=$P(AMQQCOMP,";",2)
S AMQQSQFP=$P(AMQQCOMP,";",3)
N AMQQCOMP
F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I S AMQQHIT=^(I) D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UIT
+1 ;
COMP SET X1=Z
+1 SET X2=$PIECE(AMQQCOMP,";")
+2 DO C^%DTC
+3 SET A=X
+4 SET X1=Z
+5 SET X2=$PIECE(AMQQCOMP,";",2)
+6 DO C^%DTC
+7 SET B=X
+8 QUIT
+9 ;
CDOB NEW X,Y,Z,%,I,A,B
+1 SET Z=$PIECE(^DPT(AMQP(0),0),U,3)
+2 IF Z
DO COMP
+3 FOR I=0:0
SET I=$ORDER(^UTILITY("AMQQ",$JOB,AMQQAG,AMQQUATN,I))
IF 'I
QUIT
SET Y=$PIECE(^(I),U,2)
DO CDOB1
DO TEST
+4 KILL AMQQNOT
+5 QUIT
+6 ;
CDOB1 IF Z=""
QUIT
+1 IF Y<A!(Y>B)
+2 QUIT
+3 ;
CDOD NEW X,Y,Z,%,I,A,B
+1 SET Z=""
+2 IF $DATA(^DPT(AMQP(0),.35))
SET Z=+^(.35)
IF Z
DO COMP
+3 FOR I=0:0
SET I=$ORDER(^UTILITY("AMQQ",$JOB,AMQQAG,AMQQUATN,I))
IF 'I
QUIT
SET Y=$PIECE(^(I),U,2)
DO CDOD1
DO TEST
+4 KILL AMQQNOT
+5 QUIT
+6 ;
CDOD1 IF Z=""
QUIT
+1 IF Y<B!(Y>A)
+2 QUIT
+3 ;
CAGE NEW X,Y,Z,%,I,A,B
+1 SET X1=$PIECE(^DPT(AMQP(0),0),U,3)
+2 IF X1=""
KILL X1
SET Z=""
GOTO CAGET
+3 SET X2=$PIECE(AMQQCOMP,";",4)
+4 DO C^%DTC
+5 SET Z=X
+6 DO COMP
CAGET FOR I=0:0
SET I=$ORDER(^UTILITY("AMQQ",$JOB,AMQQAG,AMQQUATN,I))
IF 'I
QUIT
SET Y=$PIECE(^(I),U,2)
DO CAGE1
DO TEST
+1 KILL AMQQNOT
+2 QUIT
+3 ;
CAGE1 IF Z=""
QUIT
+1 IF Y<A!(Y>B)
+2 QUIT
+3 ;
SUB NEW AMQQSQFS,AMQQSQFN,AMQQSQFP,I
+1 SET AM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