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

AMQQF2.m

Go to the documentation of this file.
AMQQF2 ; IHS/CMI/THL - MORE ANALYTIC FUNCTIONS ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;-----
LAST N I,J,N,X,Y,Z,%
 S J=0
 F %=0:0 S %=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,%)) Q:'%  S J=J+1,Y=$P(^(%),U,2) I Y S ^UTILITY("AMQQ",$J,"TMP",Y,%)=""
 S Z=J-AMQQCOMP
 I '$D(AMQQNOT),Z<1 G LAEXIT
 I '$D(AMQQNOT) D LA1 G LAEXIT
 I Z<1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN) G LAEXIT
LA2 S (X,N)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S N=N+1 I N>Z K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y)
LAEXIT K ^UTILITY("AMQQ",$J,"TMP"),AMQQNOT
 Q
 ;
LA1 S (X,I)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y) S I=I+1 I I=Z G LA1EXIT
LA1EXIT Q
 ;
FIRST N I,J,N,Y,Z,%
 S J=0
 F %=0:0 S %=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,%)) Q:'%  S J=J+1,Y=$P(^(%),U,2) I Y S ^UTILITY("AMQQ",$J,"TMP",Y,%)=""
 S Z=J-AMQQCOMP
 I '$D(AMQQNOT),Z<1 G FIEXIT
 I '$D(AMQQNOT) D FI1 G FIEXIT
 I Z<1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN) G FIEXIT
FI2 S (X,N)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S N=N+1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y) I N=AMQQCOMP G FIEXIT
FIEXIT K ^UTILITY("AMQQ",$J,"TMP"),AMQQNOT
 Q
 ;
FI1 S (X,I)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S I=I+1 I I>AMQQCOMP K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y)
 Q
 ;
HIGH N I,J,N,X,Y,Z,%
 S J=0
 F %=0:0 S %=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,%)) Q:'%  S J=J+1,Y=+^(%),^UTILITY("AMQQ",$J,"TMP",Y,%)=""
 S Z=J-AMQQCOMP
 I '$D(AMQQNOT),Z<1 G HGEXIT
 I '$D(AMQQNOT) D HG1 G HGEXIT
 I Z<1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN) G HGEXIT
HG2 S (X,N)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S N=N+1 I N>Z K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y)
HGEXIT K ^UTILITY("AMQQ",$J,"TMP"),AMQQNOT
 Q
 ;
HG1 S (X,I)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y) S I=I+1 I I=Z G HG1EXIT
HG1EXIT Q
 ;
LOW N I,J,N,X,Y,Z,%
 S J=0
 F %=0:0 S %=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,%)) Q:'%  S J=J+1,Y=+^(%),^UTILITY("AMQQ",$J,"TMP",Y,%)=""
 S Z=J-AMQQCOMP
 I '$D(AMQQNOT),Z<1 G LOEXIT
 I '$D(AMQQNOT) D LO1 G LOEXIT
 I Z<1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN) G LOEXIT
LO2 S (X,N)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S N=N+1 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y) I N=AMQQCOMP G LOEXIT
LOEXIT K ^UTILITY("AMQQ",$J,"TMP"),AMQQNOT
 Q
 ;
LO1 S (X,I)=0
 F  S X=$O(^UTILITY("AMQQ",$J,"TMP",X)) Q:'X  F Y=0:0 S Y=$O(^UTILITY("AMQQ",$J,"TMP",X,Y)) Q:'Y  S I=I+1 I I>AMQQCOMP K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,Y)
 Q
TYPES ;
 Q