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

AMQQ.m

Go to the documentation of this file.
AMQQ ; IHS/CMI/THL - QUERY UTILITY ENTRY ROUTINE ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ; THIS IS THE 'DEVELOPMENT' ENTRY POINT FOR Q-MAN.  THE 'PRODUCTION' ENTRY POINT IS EN^AMQQ
 ;-----
 N AMQQADAM
 S AMQQADAM=""
START D TRAP,VAR
AGAIN I $D(AMQQEN3) S AMQQEN31=AMQQEN3,AMQQEN3=-1 S AMQQOPT="SEARCH" G LOOP
 D ^AMQQOPT I $D(AMQQQUIT)!('$D(AMQQOPT)) G EXIT
LOOP F  D EXIT1^AMQQKILL,TRAP,@AMQQOPT I $D(AMQQQUIT)!($D(AMQQEN3))!('$D(AMQQOPT)) Q
 I $D(AMQQQUIT) K AMQQQUIT S AMQQAGIN=1 G AGAIN
EXIT ; ENTRY POINT FROM AMQQCMPL
 I $G(AMQQETRP)]"" S $ZT=AMQQETRP K AMQQETRP
 D EXIT1^AMQQKILL
 I $D(^%ZOSF("NBRK")) X ^("NBRK")
 I '$D(AMQQXX),'$D(AMQQYY),$D(IOF) W @IOF
 D EXIT^AMQQKILL
 Q
 ;
FAST ; ENTRY POINT FOR FAST FACTS
 I '$D(AMQQXX) W @IOF I $G(AMQQOPT)="SEARCH" W ?20,"*****  SEARCH CRITERIA  *****",!!!
INIT S (AMQQUSQL,AMQQUATN)=1
 S (AMQQUNBC,AMQQUSQN,AMQQURGN,AMQQUQQN)=0,U="^"
 ; ALL THE AMQQU* VARIABLES ARE COUNTERS WHICH MUST EXIST IN ALL
 ; ROUTINES AT ALL LEVELS AND MUST NEVER BE NEWED
RUN I '$D(AMQQXX) D ^AMQQ1,^AMQQQ:$D(AMQQXX) K AMQQXX I $D(AMQQQUIT) K:'AMQQQUIT AMQQQUIT Q
 I $D(AMQQXX) D EN^AMQQQ Q
 I $D(AMQQEN3),$G(AMQQCCLS)'="P" W !!!,"Sorry...the subject of your search must be a patient.",!!!,*7 H 3 Q
AT D ^AMQQAT
 I $D(AMQQXSQF) K AMQQXSQF D LIST G AT
 I $D(AMQQQUIT),AMQQUATN=1,AMQQQ="" Q
 I $D(AMQQQUIT) K AMQQQUIT Q
 I '$D(AMQQNOET),$$VERSION^%ZOSV(1)["Cache" S X="ERROR^AMQQ",@^%ZOSF("TRAP")
 I '$D(AMQQNOET),$$VERSION^%ZOSV(1)'["Cache" S X="ERROR^AMQQ",@^%ZOSF("TRAP")
 I $D(AMQQSCPF) K AMQQSCPF G AT
 I AMQQUATN=1,AMQQQ="" Q
 I AMQQQ="" D ^AMQQCMPL K AMQQQUIT Q
 I $D(AMQQANYF) K AMQQANYF D LIST G AT
 I $D(AMQQTXMT) K AMQQTXMT G SET
 I $D(AMQQONE),'$D(AMQQMULT) D LIST G AT
 I $D(AMQQSVFL) K AMQQSVFL D LIST G AT
SET D ^AMQQATR
 D ^AMQQATL
 D ^AMQQATS
 D LIST
 S AMQQUATN=AMQQUATN+1
 I '$D(AMQQNULL) S AMQQUNBC=AMQQUNBC+1
 K AMQQNULL
 G AT
 ;
SAVE D ^AMQQQE
 Q
 ;
VIEW D VIEW^AMQQOPT1
 Q
 ;
TRAP ;TRAP
 K AMQQNOET
 I '$D(^DD("OS")) S AMQQNOET="" Q
 S %=^DD("OS"),%=$P(^DD("OS",%,0),U) I %'["CACHE",%'["MSM",%'["MICRONETICS",%'["DSM(V" S AMQQNOET="" Q
 I '$D(AMQQNOET)!($D(AMQQADAM)),$D(^%ZOSF("BRK")) X ^("BRK")
 I '$D(^%ZOSF("TRAP"))!($D(AMQQADAM)) S AMQQNOET=""
 Q:$D(AMQQNOET)
 S AMQQETRP=$ZT
 I $$VERSION^%ZOSV(1)["Cache" S X="ERR^AMQQ",@^%ZOSF("TRAP")
 E  S X="ERR^AMQQ",@^%ZOSF("TRAP")
 Q
OLDTRAP K AMQQNOET
 I '$D(^DD("OS")) S AMQQNOET="" Q
 S %=^DD("OS")
 S %=$P(^DD("OS",%,0),U)
 I %'["MSM",%'["MICRONETICS",%'["DSM(V" S AMQQNOET="" Q
 I '$D(^%ZOSF("TRAP"))!($D(AMQQADAM)) S AMQQNOET=""
 Q
VAREN ; ENTRY POINT TO SET VARIABLES
VAR S X=$T(AMQQ+1) S AMQQVER=$P(X,";",3)
 S X=$P(^AMQQ(8,DUZ(2),0),U,6)
 F %=3,6,16 S AMQQ200(%)=$S(X:"^VA(200)",1:("^DIC("_%_")"))
 I '$D(AMQQXX) S IOP="0;79" D ^%ZIS
 I $D(AMQQRV),$D(AMQQNV) Q
 I '$D(AMQQXX) S X=$G(^%ZIS(2,IOST(0),5)),AMQQRV=$P(X,U,4),AMQQNV=$P(X,U,5)
 E  S AMQQRV=""
 I AMQQRV="" S (AMQQRV,AMQQNV)="AMQQXV",AMQQXV=""
 ;
LIST ; ENTRY POINT FROM AMQQAT1
 I $D(AMQQXX) Q
 W !!
 F %=0:0 S %=$O(^UTILITY("AMQQ",$J,"LIST",%)) Q:'%  W ! X ^(%)
 W !!
 Q
 ; 
ERROR I '$D(AMQQNOET) X "I $P($ZE,"">"")=""<INRPT""!($P($ZE,"">"")=""<INTERRUPT"")" I  W !!,"QMAN Session terminated...",!! H 2 S AMQQQUIT="" G EXIT
 D EMSG
 H 4
 D AT
 G EXIT
 ;
EMSG W !!,"WHOOPS!!!!!!!!!!!!!"
 W !,"Something just happened which caused me to come to a grinding halt."
 W !,"Try to enter the ATTRIBUTE again, but if this problem persists you must"
 W !,"take a different approach.",!!!,*7
 Q
 ;
ERR ; The following line contains vendor specific $Z for DSM and MSM - an
 ; an exemption to SAC 6.1.2.3 has been granted for version 2 only per
 ; memo dated 5/5/93 from J. MacArthur - This needs to be changed in
 ; the next release. **BRJ/IHS ** 6/7/93
 I $P($ZE,">")["<INRPT"!($P($ZE,">")["<INTERRUPT")!($P($ZE,">")["<DSCON") W !!,"Session terminated...",!! H 2 S AMQQQUIT="" G EXIT
 W !!,"ERROR DETECTED...Try again...If problem persists try a different approach",!!,*7
 H 4
 G LOOP:$D(AMQQOPT),EXIT
 ;
 ; 
 ; 
EN ;EP; PRIMARY ENTRY POINT FOR QMAN FROM THE KERNEL MENU SYSTEM
 D ^AMQQDFN
 D START
 Q
 ;
EN1 ; PROGRAMMER ENTRY POINT ; SCRIPT INTERFACE
 D ^AMQQDFN
 I '$D(AMQQXX) S AMQQFAIL=1 Q
 I '$D(AMQQYY) S AMQQFAIL=2 Q
 S X=$S($E(AMQQXX)'="^":$P(AMQQXX,"("),1:"")
 S Y=$S($E(AMQQYY)'="^":$P(AMQQYY,"("),1:"")
 S %="DT,DTIME,DUZ,IO,IOF,IOM,IOSL,IOXY,U,XQDIC,XQPSM,XQY,XQY0,ZTQUEUED,AMQQXX,AMQQYY,AMQQFAIL,AMQQADAM,AMQQSURV,AMQQARRY"
 S:X]"" %=%_","_X
 S:Y]"" %=%_","_Y
 S %="N ("_%_") D INDER"
 X %
 Q
INDER ; Special Entry Point For Call From Above Execute
 S %=$E(AMQQYY,$L(AMQQYY))
 I %="("!(%=",") S X=$E(AMQQYY,1,$L(AMQQYY)-1),Y=X_$S(%="(":"",1:")") K @Y
 I '$D(AMQQYY(0)) S AMQQYY(0)=""
 D EXIT1^AMQQKILL
 D TRAP
 D VAR
 D SEARCH
 D EXIT
 Q
 ;
EN2 ; PROGRAMMER ENTRY POINT FOR NATL LANGUAGE INTERFACE
 ; USED BY PHARMACY PKG AND OTHERS.  SET AUPNPAT = PT DFN
 I '$D(AUPNPAT) Q
 D ^AMQQDFN
 S AMQQFEN2=""
 S AMQQOPT="FAST"
 S AMQQSAUT="^DPT^"_AUPNPAT_U_$P(^DPT(AUPNPAT,0),U)
 D TRAP
 D VAR
 D LOOP
 D EXIT
 K AMQQFEN2
 Q
 ;
EN3 ; PROGRAMMER ENTRY POINT FOR SEARCH TEMPLATE SUBSTITUTION.  INPUT AMQQEN3 CONTAINS THE DIBT ENTRY NUMBER AND OUTPUT RETURNS THE TOTAL NUMBER OF ENTRIES IN THE NEW TEMPLATE
 ; IF AMQQND=0, HITS NOT DISPLAYED, AMQQND=1 DOTS WILL BE DISPLAYED FOR EACH HIT
 I '$D(AMQQEN3) S AMQQEN3=-1 Q
 I AMQQEN3 S %=$P($G(^DIBT(AMQQEN3,0)),U,4) I %'=2,%'=9000001 K % S AMQQEN3=-1 Q
 D EN
 K AMQQND
 Q
 ;