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

AMQQF.m

Go to the documentation of this file.
AMQQF ; IHS/CMI/THL - STORES 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
 ;
AVE N Y,Z,I
 S Y=0
 S Z=0
 F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I  I +^(I) S Y=Y+1,Z=+^(I)+Z
 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)
 I Y S ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,1)=$J((Z/Y),1,1)
 Q
 ;
SPAN N A,B,I,N,%,X S I=0
 F X=0:0 S X=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,X)) Q:'X  S %=+^(X) S:'$D(A) (A,B)=% S:%<A A=% S:%>B B=% S I=I+1
 K ^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)
 I I>1 S ^(AMQQUATN,1)=B-A
 Q
 ;
EXIST I $D(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)) K ^(AMQQUATN) S ^(AMQQUATN,1)="+"
 Q
 ;
NULL I '$D(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN)) S ^(AMQQUATN,1)="NULL"
 Q
 ;
GRT N I
 F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I  D GRT1,TEST
 K AMQQNOT
 Q
 ;
GRT1 I +^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)'>AMQQCOMP
 Q
 ;
LESS N I
 F I=0:0 S I=$O(^UTILITY("AMQQ",$J,AMQQAG,AMQQUATN,I)) Q:'I  D LESS1,TEST
 K AMQQNOT
 Q
 ;
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