XQOR ; SLC/KCM - Prepare to Unwind Options ;5/24/94 17:58 ;
;;8.0;KERNEL;**48,56**;Jul 10, 1995
S DIC=19,DIC(0)="AEMQ" D ^DIC K DIC Q:Y<0 S X=+Y_";DIC(19,"
EN ;Process options/protocols from top
;From: Anywhere Entry: X,{DIC,XQORFLG} Exit: none
Q:$D(X)[0 K XQORPOP,XQORQUIT
I '$D(XQORS) S XQORS=0 K ^TMP("XQORS",$J)
S XQORS=XQORS+1 ;push
I $D(XQOR("HIJACK")) S X=XQOR("HIJACK"),DIC=101 K XQOR("HIJACK")
I X?1.N1";ORD(101,"!(X?1.N1";DIC(19,") S ^TMP("XQORS",$J,XQORS,"REF")="^"_$P(X,";",2)_+X_",",^TMP("XQORS",$J,XQORS,"VPT")=X
E S:$D(DIC)[0 DIC=19 S DIC(0)="N" D ^DIC S:Y>0 ^TMP("XQORS",$J,XQORS,"REF")=DIC_+Y_",",^TMP("XQORS",$J,XQORS,"VPT")=+Y_";"_$P(DIC,"^",2) K DIC G:Y<0 EX
S XQORNEST(XQORS)=^TMP("XQORS",$J,XQORS,"VPT"),XQORNEST=XQORS
G:'$D(@(^TMP("XQORS",$J,XQORS,"REF")_"0)")) EX S ^TMP("XQORS",$J,XQORS,"FLG")=$P(^(0),"^",4)_"^^" G:$P(^TMP("XQORS",$J,XQORS,"FLG"),"^")'?1A EX
I $L($P(@(^TMP("XQORS",$J,XQORS,"REF")_"0)"),"^",3)) W !!,$P(^(0),"^",3),! D READ^XQOR4 G EX
D C19^XQOR4 G:Y<0 EX
S ^TMP("XQORS",$J,0,"FILE")=";"_$P(^TMP("XQORS",$J,XQORS,"VPT"),";",2),^TMP("XQORS",$J,XQORS,"INP")=""
I XQORS>1,$D(^TMP("XQORS",$J,XQORS-1,"ITM")),$D(^TMP("XQORS",$J,XQORS-1,"ITM",^TMP("XQORS",$J,XQORS-1,"ITM"),"IN")) S ^TMP("XQORS",$J,XQORS,"INP")=^TMP("XQORS",$J,XQORS-1,"ITM",^TMP("XQORS",$J,XQORS-1,"ITM"),"IN")
I XQORS>1,$D(XQORFLG("PI")) K XQORFLG("PI") S ^TMP("XQORS",$J,XQORS,"INP")=^TMP("XQORS",$J,XQORS-1,"INP")
S XQORNOD=^TMP("XQORS",$J,XQORS,"VPT"),XQORNOD(0)=^TMP("XQORS",$J,XQORS,"INP")
I XQORS>1,$D(^TMP("XQORS",$J,XQORS-1,"FLG")) S X=^TMP("XQORS",$J,XQORS-1,"FLG"),$P(^TMP("XQORS",$J,XQORS,"FLG"),"^",3)=$S($L($P(X,"^",5)):$P(X,"^",5),1:$P(X,"^",3))
I ^TMP("XQORS",$J,0,"FILE")=";ORD(101,",$D(@(^TMP("XQORS",$J,XQORS,"REF")_"4)")) S:$P(^(4),"^",3)="Y" $P(^TMP("XQORS",$J,XQORS,"FLG"),"^",2)=1
I ^TMP("XQORS",$J,0,"FILE")=";DIC(19,",$P(^TMP("XQORS",$J,XQORS,"FLG"),"^")="M" S $P(^TMP("XQORS",$J,XQORS,"FLG"),"^",2)=1
I $D(XQORFLG) S:$D(XQORFLG("PS")) $P(^TMP("XQORS",$J,XQORS,"FLG"),"^",2)=+XQORFLG("PS") S:$D(XQORFLG("SH")) $P(^TMP("XQORS",$J,XQORS,"FLG"),"^",3)=+XQORFLG("SH") K XQORFLG
I $D(ORITMO) S $P(^TMP("XQORS",$J,XQORS,"FLG"),"^",6)=1 K ORITMO G REDO^XQOR1
I $P(^TMP("XQORS",$J,XQORS,"FLG"),"^")="D" N XQORDLG
G LOOP^XQOR1
EX K XQORNEST(XQORS),XQORFLG,XQORNOD,XQORY,^TMP("XQORS",$J,XQORS) S XQORS=XQORS-1,XQORNEST=XQORS ;pop
I XQORS=0 K XQORNEST,XQORS,^TMP("XQORS",$J),XQORSPEW
Q
EN1 ;Process items on option/protocol only (i.e., skip initial actions)
;From: Anywhere Entry: X,DIC Exit: none
S ORITMO=1 G EN
Q
XQ ;From: Menuman Entry: XQOR Exit: XQOR
S X=+XQOR_";DIC(19," I $D(^DD(19,0,"VR")),^("VR")<5.9 G EN
G EN1
MSG(X,XQORMSG) ;Event point for HL7 messages
N DIC S DIC=101
I '$D(XQORHSTK) N XQORHSTK S XQORHSTK=-1 K ^TMP("XQORHSTK",$J)
S XQORHSTK=XQORHSTK+1
K ^TMP("XQORHSTK",$J,XQORHSTK) M ^TMP("XQORHSTK",$J,XQORHSTK)=XQORMSG
D EN^XQOR
S XQORHSTK=XQORHSTK-1
I XQORHSTK>-1 K XQORMSG M XQORMSG=^TMP("XQORHSTK",$J,XQORHSTK)
I XQORHSTK=-1 K ^TMP("XQORHSTK",$J)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXQOR 3086 printed Dec 13, 2024@02:05:54 Page 2
XQOR ; SLC/KCM - Prepare to Unwind Options ;5/24/94 17:58 ;
+1 ;;8.0;KERNEL;**48,56**;Jul 10, 1995
+2 SET DIC=19
SET DIC(0)="AEMQ"
DO ^DIC
KILL DIC
if Y<0
QUIT
SET X=+Y_";DIC(19,"
EN ;Process options/protocols from top
+1 ;From: Anywhere Entry: X,{DIC,XQORFLG} Exit: none
+2 if $DATA(X)[0
QUIT
KILL XQORPOP,XQORQUIT
+3 IF '$DATA(XQORS)
SET XQORS=0
KILL ^TMP("XQORS",$JOB)
+4 ;push
SET XQORS=XQORS+1
+5 IF $DATA(XQOR("HIJACK"))
SET X=XQOR("HIJACK")
SET DIC=101
KILL XQOR("HIJACK")
+6 IF X?1.N1";ORD(101,"!(X?1.N1";DIC(19,")
SET ^TMP("XQORS",$JOB,XQORS,"REF")="^"_$PIECE(X,";",2)_+X_","
SET ^TMP("XQORS",$JOB,XQORS,"VPT")=X
+7 IF '$TEST
if $DATA(DIC)[0
SET DIC=19
SET DIC(0)="N"
DO ^DIC
if Y>0
SET ^TMP("XQORS",$JOB,XQORS,"REF")=DIC_+Y_","
SET ^TMP("XQORS",$JOB,XQORS,"VPT")=+Y_";"_$PIECE(DIC,"^",2)
KILL DIC
if Y<0
GOTO EX
+8 SET XQORNEST(XQORS)=^TMP("XQORS",$JOB,XQORS,"VPT")
SET XQORNEST=XQORS
+9 if '$DATA(@(^TMP("XQORS",$JOB,XQORS,"REF")_"0)"))
GOTO EX
SET ^TMP("XQORS",$JOB,XQORS,"FLG")=$PIECE(^(0),"^",4)_"^^"
if $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^")'?1A
GOTO EX
+10 IF $LENGTH($PIECE(@(^TMP("XQORS",$JOB,XQORS,"REF")_"0)"),"^",3))
WRITE !!,$PIECE(^(0),"^",3),!
DO READ^XQOR4
GOTO EX
+11 DO C19^XQOR4
if Y<0
GOTO EX
+12 SET ^TMP("XQORS",$JOB,0,"FILE")=";"_$PIECE(^TMP("XQORS",$JOB,XQORS,"VPT"),";",2)
SET ^TMP("XQORS",$JOB,XQORS,"INP")=""
+13 IF XQORS>1
IF $DATA(^TMP("XQORS",$JOB,XQORS-1,"ITM"))
IF $DATA(^TMP("XQORS",$JOB,XQORS-1,"ITM",^TMP("XQORS",$JOB,XQORS-1,"ITM"),"IN"))
SET ^TMP("XQORS",$JOB,XQORS,"INP")=^TMP("XQORS",$JOB,XQORS-1,"ITM",^TMP("XQORS",$JOB,XQORS-1,"ITM"),"IN")
+14 IF XQORS>1
IF $DATA(XQORFLG("PI"))
KILL XQORFLG("PI")
SET ^TMP("XQORS",$JOB,XQORS,"INP")=^TMP("XQORS",$JOB,XQORS-1,"INP")
+15 SET XQORNOD=^TMP("XQORS",$JOB,XQORS,"VPT")
SET XQORNOD(0)=^TMP("XQORS",$JOB,XQORS,"INP")
+16 IF XQORS>1
IF $DATA(^TMP("XQORS",$JOB,XQORS-1,"FLG"))
SET X=^TMP("XQORS",$JOB,XQORS-1,"FLG")
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",3)=$SELECT($LENGTH($PIECE(X,"^",5)):$PIECE(X,"^",5),1:$PIECE(X,"^",3))
+17 IF ^TMP("XQORS",$JOB,0,"FILE")=";ORD(101,"
IF $DATA(@(^TMP("XQORS",$JOB,XQORS,"REF")_"4)"))
if $PIECE(^(4),"^",3)="Y"
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",2)=1
+18 IF ^TMP("XQORS",$JOB,0,"FILE")=";DIC(19,"
IF $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^")="M"
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",2)=1
+19 IF $DATA(XQORFLG)
if $DATA(XQORFLG("PS"))
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",2)=+XQORFLG("PS")
if $DATA(XQORFLG("SH"))
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",3)=+XQORFLG("SH")
KILL XQORFLG
+20 IF $DATA(ORITMO)
SET $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^",6)=1
KILL ORITMO
GOTO REDO^XQOR1
+21 IF $PIECE(^TMP("XQORS",$JOB,XQORS,"FLG"),"^")="D"
NEW XQORDLG
+22 GOTO LOOP^XQOR1
EX ;pop
KILL XQORNEST(XQORS),XQORFLG,XQORNOD,XQORY,^TMP("XQORS",$JOB,XQORS)
SET XQORS=XQORS-1
SET XQORNEST=XQORS
+1 IF XQORS=0
KILL XQORNEST,XQORS,^TMP("XQORS",$JOB),XQORSPEW
+2 QUIT
EN1 ;Process items on option/protocol only (i.e., skip initial actions)
+1 ;From: Anywhere Entry: X,DIC Exit: none
+2 SET ORITMO=1
GOTO EN
+3 QUIT
XQ ;From: Menuman Entry: XQOR Exit: XQOR
+1 SET X=+XQOR_";DIC(19,"
IF $DATA(^DD(19,0,"VR"))
IF ^("VR")<5.9
GOTO EN
+2 GOTO EN1
MSG(X,XQORMSG) ;Event point for HL7 messages
+1 NEW DIC
SET DIC=101
+2 IF '$DATA(XQORHSTK)
NEW XQORHSTK
SET XQORHSTK=-1
KILL ^TMP("XQORHSTK",$JOB)
+3 SET XQORHSTK=XQORHSTK+1
+4 KILL ^TMP("XQORHSTK",$JOB,XQORHSTK)
MERGE ^TMP("XQORHSTK",$JOB,XQORHSTK)=XQORMSG
+5 DO EN^XQOR
+6 SET XQORHSTK=XQORHSTK-1
+7 IF XQORHSTK>-1
KILL XQORMSG
MERGE XQORMSG=^TMP("XQORHSTK",$JOB,XQORHSTK)
+8 IF XQORHSTK=-1
KILL ^TMP("XQORHSTK",$JOB)
+9 QUIT