OCXOED12 ;SLC/RJS,CLA - Rule Editor (Data Field Options) ;3/22/01 10:46
;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,105**;Dec 17,1997
;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
;
;
S ;
;
Q
EN(OCXD0,OCXRD,OCXACT) ;
;
;
N OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN
;
S OCXTNLN=$C(27,91,48,109),OCXTRLN=$C(27,91,55,109),OCXTULN=$C(27,91,52,109),OCXTHLN=$C(27,91,49,109)
;
S OCXOPT=$$GETOPT^OCXOEDT(.OCXACT) Q:(OCXOPT=U) 1 X:$L(OCXOPT) OCXOPT
;
Q:'$D(^OCXS(860.4,OCXD0)) 1
;
Q 0
;
;
EDIT(OCXD0) ;
N X S X=$$DIE("^OCXS(860.4,",OCXD0,".01;1")
Q
;
EDLINK(OCXD1,OCXSRC) ;
;
D EN^OCXOED13(OCXD1,OCXSRC)
Q
;
LOPT(OCXMODE,OCXD0) ;
;
N OCXD1,OCXLINK,OCXSRC
;
I OCXMODE="ADD" D Q
.S:'$D(^OCXS(860.4,OCXD0,"LINK",0)) ^OCXS(860.4,OCXD0,"LINK",0)="^860.41P^^"
.S OCXD1=+$$DIC("^OCXS(860.6,","AEMQL","Data Context: ") Q:'OCXD1
.S OCXSRC=+$$DIC("^OCXS(860.5,","AEMQL"," Data Source: ") Q:'OCXSRC
.S OCXLINK=$G(^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH"))
.S:(OCXLINK[U) OCXLINK=$P(OCXLINK,U,2)
.S OCXLINK=$$DIC("^OCXS(863.3,","AEMQL","Link Name: ",OCXLINK) Q:'OCXLINK
.S ^OCXS(860.4,OCXD0,"LINK",OCXD1,0)=OCXD1_U_OCXSRC
.S ^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH")=$P(OCXLINK,U,2)
.S ^OCXS(860.4,OCXD0,"LINK","B",OCXD1,OCXD1)=""
.D EN^OCXOED13($P(OCXLINK,U,2),OCXD1)
I OCXMODE="DEL" D Q
.S:'$D(^OCXS(860.4,OCXD0,"LINK",0)) ^OCXS(860.4,OCXD0,"LINK",0)="^860.41P^^"
.N OCXD1,DA S DA(1)=OCXD0,OCXD1=+$$DIC("^OCXS(860.4,"_(+OCXD0)_",""LINK"",","AEMQ","Select Data Source to delete: ") Q:'OCXD1
.Q:'$$READ("Y","Are you sure you want to Delete ?","YES")
.Q:'$$DIE("^OCXS(860.4,"_(+OCXD0)_",""LINK"",",OCXD1,"S DA(1)="_(+OCXD0)_";.01///@")
.W !!,"Deleted..." H 1
Q
;
ADDLINK(OCXD0,OCXSRC) ;
;
N OCXD1,OCXLINK,OCXX,DA
;
S ^OCXS(860.4,OCXD0,"LINK",OCXD1,0)=OCXD1
S ^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH")=OCXLINK
S ^OCXS(860.4,OCXD0,"LINK","B",OCXD1,OCXD1)=""
D EN^OCXOED13(OCXLINK,OCXD1)
Q
;
COMP ;
D ^OCXOCMP
Q
;
;
READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
N OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
Q:'$L($G(OCXZ0)) U
S DIR(0)=OCXZ0
S:$L($G(OCXZA)) DIR("A")=OCXZA
S:$L($G(OCXZB)) DIR("B")=OCXZB
F OCXLINE=1:1:($G(OCXZL)-1) W !
D ^DIR
I $D(DTOUT)!$D(DUOUT)!$D(DIRUT)!$D(DIROUT) Q U
Q Y
;
DIE(DIE,DA,DR) ;
;
D RM(IOM) N DUOUT,DTOUT,DIC S DIC=DIE D ^DIE D RM(0) Q:$G(DTOUT) 0 Q:$G(DUOUT) 0 Q 1
;
RM(X) X ^%ZOSF("RM") Q
;
DIC(OCXDIC,OCXDIC0,OCXDICA,OCXDICB,OCXX,OCXDICS,OCXDR,DA) ;
;
N DIC,X,Y
S DIC=$G(OCXDIC) Q:'$L(DIC) -1
S DIC(0)=$G(OCXDIC0) S:$L($G(OCXX)) X=OCXX
S:$L($G(OCXDICS)) DIC("S")=OCXDICS
S:$L($G(OCXDICA)) DIC("A")=OCXDICA
S:$L($G(OCXDICB)) DIC("B")=OCXDICB
S:$L($G(OCXDR)) DIC("DR")=OCXDR
D ^DIC Q:(Y<1) 0 Q Y
;
SCREEN(TEXT,FLDNAME) ;
;
Q:'($G(TEXT)["|") TEXT
W !!,$G(FLDNAME)," Embedded Data Field Check..."
N DF,DFIEN,PTR,WARN,NODE0,NODE1
S WARN=0 F PTR=2:2:$L(TEXT,"|") S DF=$P(TEXT,"|",PTR) S:DF["." DF=$P(DF,".",2) D
.S DFIEN=0 F S DFIEN=$O(^OCXS(860.4,"B",$E(DF,1,30),DFIEN)) Q:'DFIEN Q:($P($G(^OCXS(860.4,DFIEN,0)),U,1)=DF)
.S:'DFIEN DFIEN=$O(^OCXS(860.4,"C",DF,0))
.S NODE0=$G(^OCXS(860.4,+DFIEN,0)),NODE1=$G(^OCXS(860.4,+DFIEN,1))
.;
.I 'DFIEN!'$L(NODE0) D Q:'DFIEN
..N NEWVAL
..S NEWVAL="",DFIEN=0,WARN=1 W !,$C(7),"Warning: Data Field '",DF,"'",!," is not in Data Field File."
..Q:'$$READ("Y","Do you want to substitute another field ?","YES")
..S DFIEN=+$$DIC("^OCXS(860.4,","AEMQ","Data Field: ") Q:'DFIEN
..S NODE0=$G(^OCXS(860.4,+DFIEN,0)),NODE1=$G(^OCXS(860.4,+DFIEN,1))
..I $L($P(NODE1,U,1)) S NEWVAL=$P(NODE1,U,1)
..I '$L(NEWVAL),$L($P(NODE0,U,1)) S NEWVAL=$P(NODE0,U,1)
..I $L(NEWVAL) S:($P(TEXT,"|",PTR)[".") NEWVAL=$P($P(TEXT,"|",PTR),".",1)_"."_NEWVAL S $P(TEXT,"|",PTR)=NEWVAL
.;
.W !,$J(DFIEN,5)
.W ?10,$E($P(NODE1,U,1),1,20)
.W ?31,$E($P(NODE0,U,1),1,40)
.W $S(($L($P(NODE0,U,1))>40):"...",1:"")
I 'WARN W !!,"Everything OK !!" H 1
Q TEXT
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HOCXOED12 3994 printed Dec 13, 2024@02:25:26 Page 2
OCXOED12 ;SLC/RJS,CLA - Rule Editor (Data Field Options) ;3/22/01 10:46
+1 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**32,105**;Dec 17,1997
+2 ;; ;;ORDER CHECK EXPERT version 1.01 released OCT 29,1998
+3 ;
+4 ;
S ;
+1 ;
+2 QUIT
EN(OCXD0,OCXRD,OCXACT) ;
+1 ;
+2 ;
+3 NEW OCXTHLN,OCXTNLN,OCXTRLN,OCXTULN,OCXTNLN
+4 ;
+5 SET OCXTNLN=$CHAR(27,91,48,109)
SET OCXTRLN=$CHAR(27,91,55,109)
SET OCXTULN=$CHAR(27,91,52,109)
SET OCXTHLN=$CHAR(27,91,49,109)
+6 ;
+7 SET OCXOPT=$$GETOPT^OCXOEDT(.OCXACT)
if (OCXOPT=U)
QUIT 1
if $LENGTH(OCXOPT)
XECUTE OCXOPT
+8 ;
+9 if '$DATA(^OCXS(860.4,OCXD0))
QUIT 1
+10 ;
+11 QUIT 0
+12 ;
+13 ;
EDIT(OCXD0) ;
+1 NEW X
SET X=$$DIE("^OCXS(860.4,",OCXD0,".01;1")
+2 QUIT
+3 ;
EDLINK(OCXD1,OCXSRC) ;
+1 ;
+2 DO EN^OCXOED13(OCXD1,OCXSRC)
+3 QUIT
+4 ;
LOPT(OCXMODE,OCXD0) ;
+1 ;
+2 NEW OCXD1,OCXLINK,OCXSRC
+3 ;
+4 IF OCXMODE="ADD"
Begin DoDot:1
+5 if '$DATA(^OCXS(860.4,OCXD0,"LINK",0))
SET ^OCXS(860.4,OCXD0,"LINK",0)="^860.41P^^"
+6 SET OCXD1=+$$DIC("^OCXS(860.6,","AEMQL","Data Context: ")
if 'OCXD1
QUIT
+7 SET OCXSRC=+$$DIC("^OCXS(860.5,","AEMQL"," Data Source: ")
if 'OCXSRC
QUIT
+8 SET OCXLINK=$GET(^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH"))
+9 if (OCXLINK[U)
SET OCXLINK=$PIECE(OCXLINK,U,2)
+10 SET OCXLINK=$$DIC("^OCXS(863.3,","AEMQL","Link Name: ",OCXLINK)
if 'OCXLINK
QUIT
+11 SET ^OCXS(860.4,OCXD0,"LINK",OCXD1,0)=OCXD1_U_OCXSRC
+12 SET ^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH")=$PIECE(OCXLINK,U,2)
+13 SET ^OCXS(860.4,OCXD0,"LINK","B",OCXD1,OCXD1)=""
+14 DO EN^OCXOED13($PIECE(OCXLINK,U,2),OCXD1)
End DoDot:1
QUIT
+15 IF OCXMODE="DEL"
Begin DoDot:1
+16 if '$DATA(^OCXS(860.4,OCXD0,"LINK",0))
SET ^OCXS(860.4,OCXD0,"LINK",0)="^860.41P^^"
+17 NEW OCXD1,DA
SET DA(1)=OCXD0
SET OCXD1=+$$DIC("^OCXS(860.4,"_(+OCXD0)_",""LINK"",","AEMQ","Select Data Source to delete: ")
if 'OCXD1
QUIT
+18 if '$$READ("Y","Are you sure you want to Delete ?","YES")
QUIT
+19 if '$$DIE("^OCXS(860.4,"_(+OCXD0)_",""LINK"",",OCXD1,"S DA(1)="_(+OCXD0)_";.01///@")
QUIT
+20 WRITE !!,"Deleted..."
HANG 1
End DoDot:1
QUIT
+21 QUIT
+22 ;
ADDLINK(OCXD0,OCXSRC) ;
+1 ;
+2 NEW OCXD1,OCXLINK,OCXX,DA
+3 ;
+4 SET ^OCXS(860.4,OCXD0,"LINK",OCXD1,0)=OCXD1
+5 SET ^OCXS(860.4,OCXD0,"LINK",OCXD1,"DATAPATH")=OCXLINK
+6 SET ^OCXS(860.4,OCXD0,"LINK","B",OCXD1,OCXD1)=""
+7 DO EN^OCXOED13(OCXLINK,OCXD1)
+8 QUIT
+9 ;
COMP ;
+1 DO ^OCXOCMP
+2 QUIT
+3 ;
+4 ;
READ(OCXZ0,OCXZA,OCXZB,OCXZL) ;
+1 NEW OCXLINE,DIR,DTOUT,DUOUT,DIRUT,DIROUT
+2 if '$LENGTH($GET(OCXZ0))
QUIT U
+3 SET DIR(0)=OCXZ0
+4 if $LENGTH($GET(OCXZA))
SET DIR("A")=OCXZA
+5 if $LENGTH($GET(OCXZB))
SET DIR("B")=OCXZB
+6 FOR OCXLINE=1:1:($GET(OCXZL)-1)
WRITE !
+7 DO ^DIR
+8 IF $DATA(DTOUT)!$DATA(DUOUT)!$DATA(DIRUT)!$DATA(DIROUT)
QUIT U
+9 QUIT Y
+10 ;
DIE(DIE,DA,DR) ;
+1 ;
+2 DO RM(IOM)
NEW DUOUT,DTOUT,DIC
SET DIC=DIE
DO ^DIE
DO RM(0)
if $GET(DTOUT)
QUIT 0
if $GET(DUOUT)
QUIT 0
QUIT 1
+3 ;
RM(X) XECUTE ^%ZOSF("RM")
QUIT
+1 ;
DIC(OCXDIC,OCXDIC0,OCXDICA,OCXDICB,OCXX,OCXDICS,OCXDR,DA) ;
+1 ;
+2 NEW DIC,X,Y
+3 SET DIC=$GET(OCXDIC)
if '$LENGTH(DIC)
QUIT -1
+4 SET DIC(0)=$GET(OCXDIC0)
if $LENGTH($GET(OCXX))
SET X=OCXX
+5 if $LENGTH($GET(OCXDICS))
SET DIC("S")=OCXDICS
+6 if $LENGTH($GET(OCXDICA))
SET DIC("A")=OCXDICA
+7 if $LENGTH($GET(OCXDICB))
SET DIC("B")=OCXDICB
+8 if $LENGTH($GET(OCXDR))
SET DIC("DR")=OCXDR
+9 DO ^DIC
if (Y<1)
QUIT 0
QUIT Y
+10 ;
SCREEN(TEXT,FLDNAME) ;
+1 ;
+2 if '($GET(TEXT)["|")
QUIT TEXT
+3 WRITE !!,$GET(FLDNAME)," Embedded Data Field Check..."
+4 NEW DF,DFIEN,PTR,WARN,NODE0,NODE1
+5 SET WARN=0
FOR PTR=2:2:$LENGTH(TEXT,"|")
SET DF=$PIECE(TEXT,"|",PTR)
if DF["."
SET DF=$PIECE(DF,".",2)
Begin DoDot:1
+6 SET DFIEN=0
FOR
SET DFIEN=$ORDER(^OCXS(860.4,"B",$EXTRACT(DF,1,30),DFIEN))
if 'DFIEN
QUIT
if ($PIECE($GET(^OCXS(860.4,DFIEN,0)),U,1)=DF)
QUIT
+7 if 'DFIEN
SET DFIEN=$ORDER(^OCXS(860.4,"C",DF,0))
+8 SET NODE0=$GET(^OCXS(860.4,+DFIEN,0))
SET NODE1=$GET(^OCXS(860.4,+DFIEN,1))
+9 ;
+10 IF 'DFIEN!'$LENGTH(NODE0)
Begin DoDot:2
+11 NEW NEWVAL
+12 SET NEWVAL=""
SET DFIEN=0
SET WARN=1
WRITE !,$CHAR(7),"Warning: Data Field '",DF,"'",!," is not in Data Field File."
+13 if '$$READ("Y","Do you want to substitute another field ?","YES")
QUIT
+14 SET DFIEN=+$$DIC("^OCXS(860.4,","AEMQ","Data Field: ")
if 'DFIEN
QUIT
+15 SET NODE0=$GET(^OCXS(860.4,+DFIEN,0))
SET NODE1=$GET(^OCXS(860.4,+DFIEN,1))
+16 IF $LENGTH($PIECE(NODE1,U,1))
SET NEWVAL=$PIECE(NODE1,U,1)
+17 IF '$LENGTH(NEWVAL)
IF $LENGTH($PIECE(NODE0,U,1))
SET NEWVAL=$PIECE(NODE0,U,1)
+18 IF $LENGTH(NEWVAL)
if ($PIECE(TEXT,"|",PTR)[".")
SET NEWVAL=$PIECE($PIECE(TEXT,"|",PTR),".",1)_"."_NEWVAL
SET $PIECE(TEXT,"|",PTR)=NEWVAL
End DoDot:2
if 'DFIEN
QUIT
+19 ;
+20 WRITE !,$JUSTIFY(DFIEN,5)
+21 WRITE ?10,$EXTRACT($PIECE(NODE1,U,1),1,20)
+22 WRITE ?31,$EXTRACT($PIECE(NODE0,U,1),1,40)
+23 WRITE $SELECT(($LENGTH($PIECE(NODE0,U,1))>40):"...",1:"")
End DoDot:1
+24 IF 'WARN
WRITE !!,"Everything OK !!"
HANG 1
+25 QUIT TEXT
+26 ;