AMQQCMP1 ; IHS/CMI/THL - PRELIMINARY QUERY COMPILE ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;-----
I $D(AMQQMULX) D ^AMQQCMPM I $D(AMQQQUIT) G EXIT
VAR S AMQQ="^UTILITY(""AMQQ"",$J,""WEIGHT"")"
K AMQQRED
I AMQQOPT="FAST",'$D(^UTILITY("AMQQ",$J)) S AMQQFAIL=4 D FAIL^AMQQN S AMQQQUIT=1 Q
S AMQQLINO=1
S AMQQVAR=9
S (%,AMQQSER)=$O(@AMQQ@(-9999))
S AMQQUATN=$O(@AMQQ@(+%,""))
S AMQQTURB=^(AMQQUATN)
S Q=^UTILITY("AMQQ",$J,"Q",AMQQUATN)
I $P(Q,U,17)!($P(Q,U,3)="I") S %=$P(Q,U,9),%=$P(%,";",5) I %="NULL"!(%="INVERSE")!(%="ANY") D @("START"_AMQQCCLS) G EXIT
I Q[";ALL^",$P(Q,U,3)="L" D @("START"_AMQQCCLS) G EXIT
I $D(AMQQRAND) D @("RAND"_AMQQCCLS) K AMQQRAND G EXIT
I $D(AMQQCHRT) D @("COH"_AMQQCCLS) K AMQQCHRT G EXIT
S %=$P(Q,U,9)
I %[";NULL"!(%[";ANY") D @("START"_AMQQCCLS) G EXIT
I $D(^UTILITY("AMQQ",$J,"Q",AMQQUATN,1)),$P(^(1),U,2)="NULL" D @("START"_AMQQCCLS) G EXIT
I %'["EXIST",'$P(Q,U,4),(($P(Q,U,8)["'><")!($P(Q,U,8)["'=")) D @("START"_AMQQCCLS) G EXIT
I AMQQSER>1 G EXIT
S %=$P(Q,U,15)
S %=$P(%,";",4,5)
I +%>$P(%,";",2) G EXIT
GT I AMQQTURB["AQ" D @(AMQQTURB_"^AMQQCMPT") G EXIT
I AMQQTURB S %=$P(Q,U,15),%=$P(%,";",4) I %'["*" D @("TURB"_AMQQTURB_U_$S(AMQQTURB<5:"AMQQCMPT",1:"AMQQCMPZ"))
EXIT S AMQQSER=-9999
K X,AMQQTURB,Q
Q
;
STARTH S ^UTILITY("AMQQ",$J,"Q",.1)="211^NAME (PROVIDER)^F^^^^^^^^^^^^'=;|||||;;;"
G ST1
STARTP S ^UTILITY("AMQQ",$J,"Q",.1)="3^NAME^F^^^^^^^^^^^^'=;|||||;;;"
G ST1
NOALPHA S ^UTILITY("AMQQ",$J,"Q",.1)="164^POV NUMBER^N^^^^^^^^^^^^0;999999999;"
G ST1
STARTV S ^UTILITY("AMQQ",$J,"Q",.1)="133^DATE OF VISIT^D^^^^^^^^^^^^0;99999999;"
G ST1
ST1 S ^UTILITY("AMQQ",$J,"WEIGHT",-99,.1)=""
Q
;
RANDP S ^UTILITY("AMQQ",$J,"Q",.1)="37^RANDOM^R^^^^^^^^^^^1^"_AMQQRAND
G RA1
RANDV S ^UTILITY("AMQQ",$J,"Q",.1)="140^RANDOM^R^^^^^^^^^^^1^"_AMQQRAND
G RA1
RA1 S ^UTILITY("AMQQ",$J,"WEIGHT",-99,.1)=""
Q
;
COHP S ^UTILITY("AMQQ",$J,"Q",.1)="40^COHORT^C^^^^^^^^^^^1^"_AMQQCHRT
G CO1
COHV S ^UTILITY("AMQQ",$J,"Q",.1)="141^COHORT^C^^^^^^^^^^^1^"_AMQQCHRT
G CO1
CO1 S ^UTILITY("AMQQ",$J,"WEIGHT",-99,.1)=""
Q
;
AMQQCMP1 ; IHS/CMI/THL - PRELIMINARY QUERY COMPILE ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;-----
+3 IF $DATA(AMQQMULX)
DO ^AMQQCMPM
IF $DATA(AMQQQUIT)
GOTO EXIT
VAR SET AMQQ="^UTILITY(""AMQQ"",$J,""WEIGHT"")"
+1 KILL AMQQRED
+2 IF AMQQOPT="FAST"
IF '$DATA(^UTILITY("AMQQ",$JOB))
SET AMQQFAIL=4
DO FAIL^AMQQN
SET AMQQQUIT=1
QUIT
+3 SET AMQQLINO=1
+4 SET AMQQVAR=9
+5 SET (%,AMQQSER)=$ORDER(@AMQQ@(-9999))
+6 SET AMQQUATN=$ORDER(@AMQQ@(+%,""))
+7 SET AMQQTURB=^(AMQQUATN)
+8 SET Q=^UTILITY("AMQQ",$JOB,"Q",AMQQUATN)
+9 IF $PIECE(Q,U,17)!($PIECE(Q,U,3)="I")
SET %=$PIECE(Q,U,9)
SET %=$PIECE(%,";",5)
IF %="NULL"!(%="INVERSE")!(%="ANY")
DO @("START"_AMQQCCLS)
GOTO EXIT
+10 IF Q[";ALL^"
IF $PIECE(Q,U,3)="L"
DO @("START"_AMQQCCLS)
GOTO EXIT
+11 IF $DATA(AMQQRAND)
DO @("RAND"_AMQQCCLS)
KILL AMQQRAND
GOTO EXIT
+12 IF $DATA(AMQQCHRT)
DO @("COH"_AMQQCCLS)
KILL AMQQCHRT
GOTO EXIT
+13 SET %=$PIECE(Q,U,9)
+14 IF %[";NULL"!(%[";ANY")
DO @("START"_AMQQCCLS)
GOTO EXIT
+15 IF $DATA(^UTILITY("AMQQ",$JOB,"Q",AMQQUATN,1))
IF $PIECE(^(1),U,2)="NULL"
DO @("START"_AMQQCCLS)
GOTO EXIT
+16 IF %'["EXIST"
IF '$PIECE(Q,U,4)
IF (($PIECE(Q,U,8)["'><")!($PIECE(Q,U,8)["'="))
DO @("START"_AMQQCCLS)
GOTO EXIT
+17 IF AMQQSER>1
GOTO EXIT
+18 SET %=$PIECE(Q,U,15)
+19 SET %=$PIECE(%,";",4,5)
+20 IF +%>$PIECE(%,";",2)
GOTO EXIT
GT IF AMQQTURB["AQ"
DO @(AMQQTURB_"^AMQQCMPT")
GOTO EXIT
+1 IF AMQQTURB
SET %=$PIECE(Q,U,15)
SET %=$PIECE(%,";",4)
IF %'["*"
DO @("TURB"_AMQQTURB_U_$SELECT(AMQQTURB<5:"AMQQCMPT",1:"AMQQCMPZ"))
EXIT SET AMQQSER=-9999
+1 KILL X,AMQQTURB,Q
+2 QUIT
+3 ;
STARTH SET ^UTILITY("AMQQ",$JOB,"Q",.1)="211^NAME (PROVIDER)^F^^^^^^^^^^^^'=;|||||;;;"
+1 GOTO ST1
STARTP SET ^UTILITY("AMQQ",$JOB,"Q",.1)="3^NAME^F^^^^^^^^^^^^'=;|||||;;;"
+1 GOTO ST1
NOALPHA SET ^UTILITY("AMQQ",$JOB,"Q",.1)="164^POV NUMBER^N^^^^^^^^^^^^0;999999999;"
+1 GOTO ST1
STARTV SET ^UTILITY("AMQQ",$JOB,"Q",.1)="133^DATE OF VISIT^D^^^^^^^^^^^^0;99999999;"
+1 GOTO ST1
ST1 SET ^UTILITY("AMQQ",$JOB,"WEIGHT",-99,.1)=""
+1 QUIT
+2 ;
RANDP SET ^UTILITY("AMQQ",$JOB,"Q",.1)="37^RANDOM^R^^^^^^^^^^^1^"_AMQQRAND
+1 GOTO RA1
RANDV SET ^UTILITY("AMQQ",$JOB,"Q",.1)="140^RANDOM^R^^^^^^^^^^^1^"_AMQQRAND
+1 GOTO RA1
RA1 SET ^UTILITY("AMQQ",$JOB,"WEIGHT",-99,.1)=""
+1 QUIT
+2 ;
COHP SET ^UTILITY("AMQQ",$JOB,"Q",.1)="40^COHORT^C^^^^^^^^^^^1^"_AMQQCHRT
+1 GOTO CO1
COHV SET ^UTILITY("AMQQ",$JOB,"Q",.1)="141^COHORT^C^^^^^^^^^^^1^"_AMQQCHRT
+1 GOTO CO1
CO1 SET ^UTILITY("AMQQ",$JOB,"WEIGHT",-99,.1)=""
+1 QUIT
+2 ;