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

AMQQSQS.m

Go to the documentation of this file.
AMQQSQS ;IHS/CMI/THL - SETS INSTRUCTIONS FOR SUBQUERY ATTRIBUTES ;
 ;;2.0;IHS PCC SUITE;**6,7**;MAY 14, 2009
 ;-----
RUN I AMQQSQFN=1 D SET1
 D FLAGS
 I $G(AMQQSQNC) S AMQQNOCO=AMQQSQNC
 I $D(AMQQSQNT) S AMQQNOT=""
 I '$D(AMQQSQSC),$D(AMQQSQRC) S AMQQSQRC=AMQQSQNN
 I '$D(AMQQSQSC),$D(AMQQSQAA) D SET2
 I '$D(AMQQSQSC),"LVM"'[$E(AMQQSQCT) D SET3
 D ^AMQQSQL
EXIT K AMQQSQSC,%
 Q
 ;
SET1 ; ENTRY POINT FROM AMQQSQP
 S AMQQUSQN=AMQQUSQN+1
 S AMQQSQNN=AMQQUSQN
 S AMQQFSQN=""
 S %=AMQQSQAN
 I $G(AMQQSQST)="I",$P($G(AMQQCOMP),";",4)'="" S %=%_" ("_$P(AMQQCOMP,";",4)_")"
 I '$D(AMQQXX) S ^UTILITY("AMQQ",$J,"SQL",AMQQSQNN,.1)="W "_$S($D(AMQQGVF):"!!?3",1:("?"_(3*AMQQUSQL+6)))_",@AMQQRV,"""_$S($D(AMQQGVF):"Generic VISIT conditions",1:("Subject of subquery: "_%))_""",@AMQQNV"
 I '$D(AMQQXX),AMQQLINK>764,AMQQLINK<768 S ^UTILITY("AMQQ",$J,"SQL",AMQQSQNN,.1)=^UTILITY("AMQQ",$J,"SQL",AMQQSQNN,.1)_" days"
 I '$D(AMQQLSQF) S AMQQLSQF=AMQQSQNN
 K ^UTILITY("AMQQ",$J,"SQ",AMQQSQNN)
 Q
 ;
SET2 I AMQQUSQL>1 S ^UTILITY("AMQQ",$J,"SQXS",AMQQSQAA,AMQQSQNN)="",AMQQSQDF="" Q
 S ^UTILITY("AMQQ",$J,"SQXQ",AMQQSQAA,AMQQSQNN)=""
 K AMQQSQAA
 Q
 ;
SET3 I AMQQSQCT'="B" G SETSQ
 S %=^AMQQ(4,AMQQSQTP,0),%=$P(%,U)
 I "EV"[% S AMQQSQF1="BP",AMQQSQF2="AMQQF1" G SETSQ
SETSQ S ^UTILITY("AMQQ",$J,"SQ",AMQQSQNN,AMQQSQFN)=AMQQSQN_U_AMQQSQNM_U_AMQQSQTP_U_AMQQSQF1_U_AMQQSQF2_U_AMQQSQCT_U_AMQQSQCV_U_$D(AMQQSQNT)
 Q
 ;
FLAGS I AMQQSQCT="C" S (AMQQSQGF,AMQQSQCF)="" S:AMQQUSQL=1 AMQQFRED=1 Q
 I AMQQSQCT="T" S (AMQQSQTF,AMQQSQGF)="" Q
 I '$D(AMQQSQGF),AMQQSQCT="B",'$D(AMQQSQBF) D SETCOMPV Q
 I (AMQQSQN=59!((AMQQSQN>315)&(AMQQSQN<319))),'$D(AMQQSQGF),'$D(AMQQSQDF) K AMQQSQQF D SETCOMPD Q
 I '$D(AMQQSQGF),AMQQSQCT="D",'$D(AMQQSQDF) D SETCOMPD Q
 I '$D(AMQQSQGF),AMQQSQCT="S",'$D(AMQQSQBF) D SETCOMPS Q
 I '$D(AMQQSQGF),AMQQSQNM="LAST" S (AMQQSQGF,AMQQSQSC)="",$P(AMQQCOMP,";",3)=AMQQSQCV Q
 I AMQQSQCT="N" S AMQQSQNF="" Q
 I "MOL"[AMQQSQCT S AMQQSQGF="" Q
 Q
 ;
SETCOMPV S AMQQSQBF=""
 I $D(AMQQSQNT) S AMQQSQBS="'"_AMQQSQBS
 I $P(AMQQCOMP,";",4)="" S AMQQSQSC=""
 I $G(AMQQSQST)="E"!($G(AMQQSQST)="V") S $P(AMQQCOMP,";",4)=AMQQSQCV Q
 I AMQQSQCV'[";" S $P(AMQQCOMP,";",4)=AMQQSQBS_":"_AMQQSQCV S:$D(AMQQRECV) $P(AMQQRECV,U,11)=$P(AMQQCOMP,";",4) Q
 S $P(AMQQCOMP,";",4)="'<:"_$P(AMQQSQCV,";")_":'>:"_$P(AMQQSQCV,";",2)
 Q
 ;
SETCOMPS S AMQQSQBF=""
 I $D(AMQQSQNT) S AMQQSQBS="'"_AMQQSQBS
 I $P(AMQQCOMP,";",4)="" S AMQQSQSC=""
 S $P(AMQQCOMP,";",4)=AMQQSQBS_":"_AMQQSQCV
 S $P(AMQQRECV,U,11)=$P(AMQQCOMP,";",4)
 Q
 ;
SETCOMPD S AMQQSQDF=""
 S:'$D(AMQQCOMP) AMQQCOMP=""
 I $P(AMQQCOMP,";")="" S AMQQSQSC=""
 I AMQQSQCV[";" F %=1,2 S $P(AMQQCOMP,";",%)=$P(AMQQSQCV,";",%) I %=2 G SETCEXIT
 I AMQQSQBS="<" S $P(AMQQCOMP,";",1)=0,$P(AMQQCOMP,";",2)=AMQQSQCV Q
 I AMQQSQBS="=" S $P(AMQQCOMP,";",1)=AMQQSQCV,$P(AMQQCOMP,";",2)=AMQQSQCV Q
 S $P(AMQQCOMP,";",1)=AMQQSQCV
 S $P(AMQQCOMP,";",2)=9999999
SETCEXIT Q
 ;