AMQQSQL1 ; IHS/CMI/THL - GETS OVERFLOW FROM AMQQSQL ;
;;2.0;IHS PCC SUITE;;MAY 14, 2009
;-----
DT ; ENTRY POINT FROM AMQQSQL
S X=AMQQCOMP
G D1
DATE ; ENTRY POINT FROM AMQQSQL
N AMQQSQCV,AMQQSQBS
S AMQQSQCV=$P(AMQQQ,U,9),AMQQSQBS=$P(AMQQQ,U,8)
N X,Y
S X=AMQQSQCV
D1 I X="" Q
S AMQQSQLS=AMQQSQLS_$P(AMQQQ,U,2)_" "
I $D(AMQQSQNT) S AMQQSQLS=AMQQSQLS_"NOT "
I AMQQSQBS="<" S Y=+AMQQSQCV X ^DD("DD") S AMQQSQLS=AMQQSQLS_"BEFORE "_Y Q
I AMQQSQBS=">" S Y=+AMQQSQCV X ^DD("DD") S AMQQSQLS=AMQQSQLS_"AFTER "_Y Q
I AMQQSQBS="=" S Y=+AMQQSQCV X ^DD("DD") S AMQQSQLS=AMQQSQLS_"ON "_Y Q
I AMQQSQBS="%" S AMQQSQLS=AMQQSQLS_"RELATIVE TO VISIT DATE" Q
S Y=$P(AMQQSQCV,";",2)
X ^DD("DD")
S Z=Y
S Y=$P(AMQQSQCV,";")
X ^DD("DD")
S AMQQSQLS=AMQQSQLS_"BETWEEN "_Y_" and "_Z
Q
;
FREE ; ENTRY POINT FROM AMQQSQL
N AMQQSQCV,AMQQSQBS,X,AMQQSQSP
S AMQQSQCV=$P(AMQQQ,U,9)
S AMQQSQBS=$P(AMQQQ,U,8)
S %=$P(AMQQSQCV,";",4)
I %="NULL"!(%="EXISTS")!(%="ALL") S AMQQSQSP=%
I $D(AMQQSQNT),$G(AMQQSQSP)="NULL" K AMQQSQNT S AMQQSQSP="EXISTS"
I $D(AMQQSQNT),$G(AMQQSQSP)="EXISTS" K AMQQSQNT S AMQQSQSP="NULL"
S AMQQSQLS=AMQQSQLS_$P(AMQQQ,U,2)_" "
I $G(AMQQSQSP)'="" S AMQQSQLS=AMQQSQLS_$S(AMQQSQSP="NULL":"IS NULL",1:AMQQSQSP) Q
I $D(AMQQSQNT) S AMQQSQLS=AMQQSQLS_"NOT "
I AMQQSQBS'="-" S X=$F("[]=$#?",AMQQSQBS)-1,X=$P("CONTAINS^FOLLOWS^IS^STARTS WITH^ENDS WITH^MATCHES",U,X)_" "_AMQQSQCV,AMQQSQLS=AMQQSQLS_X Q
Q
;
SET ; ENTRY POINT FROM AMQQSQL
N X,%
S %=$G(^AMQQ(1,+AMQQQ,4,1,1)),X=$P(AMQQQ,U,9)
I %'="",X X % S AMQQSQLS=AMQQSQLS_$P(AMQQQ,U,2)_" "_$P(AMQQQ,U,8)_" "_X
Q
;
AMQQSQL1 ; IHS/CMI/THL - GETS OVERFLOW FROM AMQQSQL ;
+1 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
+2 ;-----
DT ; ENTRY POINT FROM AMQQSQL
+1 SET X=AMQQCOMP
+2 GOTO D1
DATE ; ENTRY POINT FROM AMQQSQL
+1 NEW AMQQSQCV,AMQQSQBS
+2 SET AMQQSQCV=$PIECE(AMQQQ,U,9)
SET AMQQSQBS=$PIECE(AMQQQ,U,8)
+3 NEW X,Y
+4 SET X=AMQQSQCV
D1 IF X=""
QUIT
+1 SET AMQQSQLS=AMQQSQLS_$PIECE(AMQQQ,U,2)_" "
+2 IF $DATA(AMQQSQNT)
SET AMQQSQLS=AMQQSQLS_"NOT "
+3 IF AMQQSQBS="<"
SET Y=+AMQQSQCV
XECUTE ^DD("DD")
SET AMQQSQLS=AMQQSQLS_"BEFORE "_Y
QUIT
+4 IF AMQQSQBS=">"
SET Y=+AMQQSQCV
XECUTE ^DD("DD")
SET AMQQSQLS=AMQQSQLS_"AFTER "_Y
QUIT
+5 IF AMQQSQBS="="
SET Y=+AMQQSQCV
XECUTE ^DD("DD")
SET AMQQSQLS=AMQQSQLS_"ON "_Y
QUIT
+6 IF AMQQSQBS="%"
SET AMQQSQLS=AMQQSQLS_"RELATIVE TO VISIT DATE"
QUIT
+7 SET Y=$PIECE(AMQQSQCV,";",2)
+8 XECUTE ^DD("DD")
+9 SET Z=Y
+10 SET Y=$PIECE(AMQQSQCV,";")
+11 XECUTE ^DD("DD")
+12 SET AMQQSQLS=AMQQSQLS_"BETWEEN "_Y_" and "_Z
+13 QUIT
+14 ;
FREE ; ENTRY POINT FROM AMQQSQL
+1 NEW AMQQSQCV,AMQQSQBS,X,AMQQSQSP
+2 SET AMQQSQCV=$PIECE(AMQQQ,U,9)
+3 SET AMQQSQBS=$PIECE(AMQQQ,U,8)
+4 SET %=$PIECE(AMQQSQCV,";",4)
+5 IF %="NULL"!(%="EXISTS")!(%="ALL")
SET AMQQSQSP=%
+6 IF $DATA(AMQQSQNT)
IF $GET(AMQQSQSP)="NULL"
KILL AMQQSQNT
SET AMQQSQSP="EXISTS"
+7 IF $DATA(AMQQSQNT)
IF $GET(AMQQSQSP)="EXISTS"
KILL AMQQSQNT
SET AMQQSQSP="NULL"
+8 SET AMQQSQLS=AMQQSQLS_$PIECE(AMQQQ,U,2)_" "
+9 IF $GET(AMQQSQSP)'=""
SET AMQQSQLS=AMQQSQLS_$SELECT(AMQQSQSP="NULL":"IS NULL",1:AMQQSQSP)
QUIT
+10 IF $DATA(AMQQSQNT)
SET AMQQSQLS=AMQQSQLS_"NOT "
+11 IF AMQQSQBS'="-"
SET X=$FIND("[]=$#?",AMQQSQBS)-1
SET X=$PIECE("CONTAINS^FOLLOWS^IS^STARTS WITH^ENDS WITH^MATCHES",U,X)_" "_AMQQSQCV
SET AMQQSQLS=AMQQSQLS_X
QUIT
+12 QUIT
+13 ;
SET ; ENTRY POINT FROM AMQQSQL
+1 NEW X,%
+2 SET %=$GET(^AMQQ(1,+AMQQQ,4,1,1))
SET X=$PIECE(AMQQQ,U,9)
+3 IF %'=""
IF X
XECUTE %
SET AMQQSQLS=AMQQSQLS_$PIECE(AMQQQ,U,2)_" "_$PIECE(AMQQQ,U,8)_" "_X
+4 QUIT
+5 ;