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

LEXRXF.m

Go to the documentation of this file.
LEXRXF ;ISL/KER - Re-Index 757.21 B/C/AA ;05/23/2017
 ;;2.0;LEXICON UTILITY;**81,80,103**;Sep 23, 1996;Build 2
 ;               
 ; Global Variables
 ;    ^LEX(757)           SACC 1.3
 ;    ^LEX(757.01)        SACC 1.3
 ;    ^LEX(757.011)       SACC 1.3
 ;    ^LEX(757.21)        SACC 1.3
 ;    ^LEXT(757.2)        SACC 1.3
 ;    ^TMP("LEXRX",$J)    SACC 2.3.2.5.1
 ;    ^TMP("LEXRXF",$J)   SACC 2.3.2.5.1
 ;    ^TMP("LEXTKN",$J)   SACC 2.3.2.5.1
 ;    ^TMP("LEXWRD",$J)   SACC 2.3.2.5.1
 ;               
 ; External References
 ;    FILE^DID            ICR   2052
 ;    ^DIK                ICR  10013
 ;    IXALL^DIK           ICR  10013
 ;    $$FMDIFF^XLFDT      ICR  10103
 ;    $$NOW^XLFDT         ICR  10103
 ;    $$UP^XLFSTR         ICR  10104
 ;               
 ; Local Variables NEWed or KILLed Elsewhere
 ;     LEXFIX     Fix Index flag  NEWed/KILLed by LEXRXXT
 ;     LEXNAM     Task name       NEWed/KILLed by LEXRXXT
 ;     LEXQ       Quiet flat      NEWed/KILLed by LEXRXXT2
 ;     LEXSET     Re-Index flag   NEWed/KILLed by LEXRXXT
 ;     LEXTEST    Test variable   NEWed/KILLed by Developer
 ;     ZTQUEUED   Task flag       NEWed/KILLed by Taskman
 ;     ZTREQ      Task Reqest     NEWed/KILLed by Taskman
 ;               
 Q
EN ; Main Entry Point
R75721 ; Repair file 757.21
 K ^TMP("LEXRXF",$J) D RB,RC,RAA,SET K ^TMP("LEXRXF",$J)
 Q
RB ;   Index    ^LEX(757.21,"B",EXP,IEN)
 N DA,DIK,LEXBEG,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXMC,LEXNDS,LEXOK,LEXSTR
 S LEXFI="757.21"
 N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.21 ""B""") Q:LEXTC=1
 S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXERR)=0,LEXSTR="",LEXFI=757.21,LEXIDX="B",LEXIDXT="^LEX(757.21,""B"",EXP,IEN)"
 F  S LEXSTR=$O(^LEX(LEXFI,LEXIDX,LEXSTR)) Q:'$L(LEXSTR)  D
 . N LEXIEN S LEXIEN=0 F  S LEXIEN=$O(^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)) Q:+LEXIEN'>0  D
 . . S LEXNDS=LEXNDS+1 N LEXOK,LEXEX S LEXEX=$P($G(^LEX(LEXFI,LEXIEN,0)),"^",1)
 . . S LEXOK=0 S:LEXEX=LEXSTR LEXOK=1 I 'LEXOK D
 . . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN) S:$L(LEXEX) ^LEX(LEXFI,LEXIDX,LEXEX,LEXIEN)=""
 . . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58,"  ",LEXIEN
 S LEXIEN=0 F  S LEXIEN=$O(^LEX(LEXFI,LEXIEN)) Q:+LEXIEN'>0  D
 . N DA,DIK,X S DA=LEXIEN,X=$P($G(^LEX(LEXFI,DA,0)),"^",1) Q:'$L(X)
 . I '$D(^LEX(LEXFI,LEXIDX,X,DA)) D
 . . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing ",X,?58,"  ",DA
 . S:$L(X) ^LEX(LEXFI,LEXIDX,X,DA)=""
 S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
 H 1 S LEXEND=$$NOW^XLFDT,LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
 S:$E(LEXELP,1)=" "&($E(LEXELP,3)=":") LEXELP=$TR(LEXELP," ","0")
 D REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
 Q
RC ;   Index    ^LEX(757.21,"C",EXP,IEN) 
 N DA,DIK,LEXBEG,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXMC,LEXNDS,LEXOK,LEXSTR
 S LEXFI="757.21"
 N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.21 ""C""") Q:LEXTC=1
 S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXERR)=0,LEXSTR="",LEXFI=757.21,LEXIDX="C",LEXIDXT="^LEX(757.21,""C"",EXP,IEN)"
 F  S LEXSTR=$O(^LEX(LEXFI,LEXIDX,LEXSTR)) Q:'$L(LEXSTR)  D
 . N LEXIEN S LEXIEN=0 F  S LEXIEN=$O(^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)) Q:+LEXIEN'>0  D
 . . S LEXNDS=LEXNDS+1 N LEXOK,LEXEX,LEXEXP
 . . S LEXEX=$P($G(^LEX(LEXFI,LEXIEN,0)),"^",1)
 . . S LEXEXP=$E($$UP^XLFSTR($G(^LEX(757.01,+($G(LEXEX)),0))),1,63)
 . . S LEXOK=0 S:LEXEXP=LEXSTR LEXOK=1 I 'LEXOK D
 . . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,"C",LEXSTR,LEXIEN) S:$L(LEXEXP) ^LEX(LEXFI,"C",LEXEXP,LEXIEN)=""
 . . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,28),?58,"  ",LEXIEN
 S LEXIEN=0 F  S LEXIEN=$O(^LEX(LEXFI,LEXIEN)) Q:+LEXIEN'>0  D
 . N DA,DIK,X,LEXEXP S DA=LEXIEN,X=$P($G(^LEX(LEXFI,DA,0)),"^",1),LEXEXP=$E($$UP^XLFSTR(^LEX(757.01,X,0)),1,63)
 . Q:+X'>0  Q:'$L(LEXEXP)
 . I '$D(^LEX(LEXFI,LEXIDX,LEXEXP,DA)) D
 . . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing ",$E(LEXEXP,1,20),?58,"  ",DA
 . S ^LEX(LEXFI,LEXIDX,LEXEXP,DA)=""
 S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
 H 1 S LEXEND=$$NOW^XLFDT,LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
 S:$E(LEXELP,1)=" "&($E(LEXELP,3)=":") LEXELP=$TR(LEXELP," ","0")
 D REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
 Q
RAA ;   Index    ^LEX(757.21,("A"_SUBSET),WORD,IEN) 
 ;            ^LEX(757.21,"ADEN",WORD,IEN)
 ;            ^LEX(757.21,"AIMM",WORD,IEN)
 ;            ^LEX(757.21,"ANUR",WORD,IEN)
 ;            ^LEX(757.21,"ASOC",WORD,IEN)
 ;            ^LEX(757.21,[etc],WORD,IEN)
 ;
 S:$D(ZTQUEUED) ZTREQ="@" N LEXARY,LEXBEG,LEXCT,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT
 N LEXIEN,LEXIT,LEXKEY,LEXKEYS,LEXMIS,LEXND,LEXSERR,LEXSIEN,LEXSNDS,LEXSTR,LEXTC,LEXTIM,X
 S LEXFI="757.21" K ^TMP("LEXRXF",$J) S:'$L($G(LEXNAM)) LEXNAM="LEXRXONE"
 N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.21 ""AA""") Q:LEXTC=1
 S LEXBEG=$$NOW^XLFDT,(LEXSNDS)=0,LEXSTR="",LEXFI=757.21,LEXIDX=" "
 S LEXFI=757.21,(LEXMIS,LEXIT)=0,LEXIDX="A" F  S LEXIDX=$O(^LEX(757.21,LEXIDX)) Q:'$L(LEXIDX)  D  Q:LEXIT>0
 . K ^TMP("LEXRXF",$J,LEXIDX) Q:$E(LEXIDX,1)'="A"  Q:$L(LEXIDX)'=4
 . N LEXTC,LEXSTR,LEXCT,LEXBEG,LEXEND,LEXTIM,LEXERR,LEXNDS
 . S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,("Repairing File #757.21 """_LEXIDX_""""))
 . S (LEXNDS,LEXERR)=0,LEXTIM="",LEXBEG=$$NOW^XLFDT,LEXSTR="",LEXCT=0
 . I '$D(ZTQUEUED) W !,"^LEX(757.21,""",LEXIDX,""")"
 . F  S LEXSTR=$O(^LEX(757.21,LEXIDX,LEXSTR)) Q:'$L(LEXSTR)  D
 . . N LEXIEN S LEXIEN=0 F  S LEXIEN=$O(^LEX(757.21,LEXIDX,LEXSTR,LEXIEN)) Q:+LEXIEN'>0  D
 . . . N LEXEXI S LEXEXI=+($G(^LEX(757.21,+LEXIEN,0)))
 . . . S LEXSNDS=+($G(LEXSNDS))+1,LEXNDS=+($G(LEXNDS))+1,^TMP("LEXRXF",$J,LEXIDX,"N")=LEXNDS,LEXCT=LEXCT+1
 . . . I '$D(^LEX(757.21,LEXIEN,0)) D  Q
 . . . . S LEXERR=+($G(LEXERR))+1,^TMP("LEXRXF",$J,LEXIDX,"E")=LEXERR
 . . . . K:'$D(LEXTEST) ^LEX(757.21,LEXIDX,LEXSTR,LEXIEN)
 . . . . I '$D(ZTQUEUED) W !,?8,757.21,?19,LEXIDX,?30,LEXSTR,?58,"  ",LEXIEN
 . . . N LEXKEY,LEXKEYS,LEXDEA,LEXTTYP S LEXDEA=$$DEA(+LEXEXI) Q:+LEXDEA>0
 . . . S LEXTTYP=$P($G(^LEX(757.01,+LEXEXI,1)),"^",2) Q:LEXTTYP=8
 . . . K LEXKEYS D KEYS(LEXIEN,.LEXKEYS,LEXIDX)
 . . . I '$D(LEXKEYS(LEXSTR)) D  Q
 . . . . S LEXERR=+($G(LEXERR))+1,^TMP("LEXRXF",$J,LEXIDX,"E")=LEXERR
 . . . . K:'$D(LEXTEST) ^LEX(757.21,LEXIDX,LEXSTR,LEXIEN)
 . . . . I '$D(ZTQUEUED) W !,?8,757.21,?19,LEXIDX,?30,LEXSTR,?58,"  ",LEXIEN
 . . . S LEXKEY="" F  S LEXKEY=$O(LEXKEYS(LEXKEY)) Q:'$L(LEXKEY)  D
 . . . . N LEXND S LEXND="^LEX(757.21,"""_LEXIDX_""","""_LEXKEY_""","_+LEXIEN_")"
 . . . . I '$D(@LEXND) S LEXMIS=+($G(LEXMIS))+1,LEXERR=+($G(LEXERR))+1,^TMP("LEXRXF",$J,LEXIDX,"E")=LEXERR
 . . . . S:'$D(LEXTEST) @LEXND=""
 . . . . W:'$D(ZTQUEUED)&('$D(@LEXND)) !,$J(LEXCT,6),?15,LEXND S @LEXND=""
 . I '$D(ZTQUEUED),+($G(LEXCT))>0 D
 . . I +($G(LEXERR))'>0 W ?22,$J(+($G(LEXCT)),12)," Tested"
 . . I +($G(LEXERR))>0 W !,?22,$J(+($G(LEXCT)),12),"/",+($G(LEXERR))," Tested/Errors"
 . H 1 S LEXEND=$$NOW^XLFDT,LEXTIM=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
 . S:$E(LEXTIM,1)=" "&($E(LEXTIM,3)=":") LEXTIM=$TR(LEXTIM," ","0")
 . S ^TMP("LEXRXF",$J,LEXIDX,"T")=LEXTIM
 H 1 S LEXEND=$$NOW^XLFDT,LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
 ;
 N LEXSIEN S LEXSIEN=0 F  S LEXSIEN=$O(^LEX(757.12,LEXSIEN)) Q:+LEXSIEN'>0  D
 . N LEXEX,LEXSS,LEXSSN,LEXKEY,LEXKEYS
 . S LEXSS=+($P($G(^LEX(757.21,+LEXSIEN,0)),"^",2))
 . S LEXSSN=$P($G(^LEXT(757.2,+LEXSS,5)),"^",2) Q:$L(LEXSSN)'=3  S LEXSSN="A"_LEXSSN
 . K LEXKEYS D KEYS(LEXSIEN,.LEXKEYS,LEXSSN)
 . S LEXKEY="" F  S LEXKEY=$O(LEXKEYS(LEXKEY)) Q:'$L(LEXKEY)  D
 . . S ^LEX(757.21,LEXSSN,LEXKEY,LEXSIEN)=""
 ;
 S:$E(LEXELP,1)=" "&($E(LEXELP,3)=":") LEXELP=$TR(LEXELP," ","0")
 S (LEXSNDS,LEXSERR)=0,LEXIDX=" " F  S LEXIDX=$O(^LEX(757.21,LEXIDX)) Q:'$L(LEXIDX)  D
 . Q:$L(LEXIDX)'>1  N LEXE,LEXN S LEXE=$G(^TMP("LEXRXF",$J,LEXIDX,"E")),LEXSERR=LEXSERR+LEXE
 . S LEXN=$G(^TMP("LEXRXF",$J,LEXIDX,"N")),LEXSNDS=LEXSNDS+LEXN
 D REP^LEXRXXS(LEXFI,LEXFI,"A***",LEXSNDS,LEXSERR,"^LEX(757.21,""A***"",WORD,IEN)",LEXELP)
 S LEXIDX=" " F  S LEXIDX=$O(^LEX(757.21,LEXIDX)) Q:'$L(LEXIDX)  D
 . Q:$L(LEXIDX)>1  N LEXE,LEXN S LEXE=$G(^TMP("LEXRXF",$J,LEXIDX,"E")),LEXSERR=LEXSERR+LEXE
 . S LEXN=$G(^TMP("LEXRXF",$J,LEXIDX,"N")),LEXSNDS=LEXSNDS+LEXN
 S ^TMP("LEXRX",$J,"TERR")=+($G(LEXSERR))
 S LEXIDX=" " F  S LEXIDX=$O(^LEX(757.21,LEXIDX)) Q:'$L(LEXIDX)  D
 . Q:LEXIDX="B"  Q:LEXIDX="C"
 . N LEXFI,LEXERR,LEXELP,LEXNDS,LEXIDXT S LEXFI=757.21
 . S LEXERR=$G(^TMP("LEXRXF",$J,LEXIDX,"E"))
 . S LEXNDS=$G(^TMP("LEXRXF",$J,LEXIDX,"N"))
 . S LEXELP=$G(^TMP("LEXRXF",$J,LEXIDX,"T"))
 . S LEXIDXT="^LEX(757.21,"""_LEXIDX_""",WORD,IEN)"
 . S LEXERR=$S(+($G(LEXERR))>0:LEXERR,1:"")
 . S LEXNDS=$S(+($G(LEXNDS))>0:LEXNDS,1:"")
 . S LEXELP=$S($L($G(LEXELP))>0:LEXELP,1:"")
 . D REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
 K ^TMP("LEXRXF",$J)
 Q
 ;              
 ; Miscellaneous
KEYS(X,LEXARY,LEXIDX) ;   Parse Sub-Set Expression into Keywords
 N LEXSI,LEXEXI,LEXEXP,LEXI,LEXIEN,LEXK,LEXMC,LEXSIEN K LEXARY
 S LEXSI=+($G(X)) Q:+LEXSI'>0  Q:'$D(^LEX(757.21,+LEXSI,0))
 S LEXIDX=$G(LEXIDX) Q:'$L(LEXIDX)  Q:$L(LEXIDX)'=4  Q:$E(LEXIDX,1)'="A"
 S LEXIEN=+($G(^LEX(757.21,+LEXSI,0))) Q:'$D(^LEX(757.01,+LEXIEN,0))
 S LEXMC=+($G(^LEX(757.01,LEXIEN,1))) Q:LEXMC'>0  Q:'$D(^LEX(757,+LEXMC,0))
 S LEXEXI=0 F  S LEXEXI=$O(^LEX(757.01,"AMC",+LEXMC,LEXEXI)) Q:+LEXEXI'>0  D
 . N X,LEXEXP,LEXTTYP,LEXDEA,LEXI S LEXDEA=$$DEA(+LEXEXI) Q:+($G(LEXDEA))>0
 . S LEXTTYP=+($P($G(^LEX(757.01,+LEXEXI,1)),"^",2)) Q:LEXTTYP=8
 . S (X,LEXEXP)=$G(^LEX(757.01,+LEXEXI,0)) K ^TMP("LEXTKN",$J) D PTX^LEXTOKN
 . S LEXI=0 F  S LEXI=$O(^TMP("LEXTKN",$J,LEXI)) Q:+LEXI'>0  D
 . . S:$L($O(^TMP("LEXTKN",$J,LEXI,""))) LEXARY($O(^TMP("LEXTKN",$J,LEXI,"")))=""
 . I $D(^LEX(757.01,+LEXEXI,5,"B")) D SUP(+LEXEXI,.LEXARY)
 . I $D(^LEX(757.05,"AEXP",+LEXEXI)) D REP(+LEXEXI,.LEXARY)
 K ^TMP("LEXTKN",$J)
 Q
SUP(X,LEXARY) ;   Supplemental Keywords
 I $D(^LEX(757.01,+($G(X)),5,"B")) D
 . N LEXK S LEXK="" F  S LEXK=$O(^LEX(757.01,+($G(X)),5,"B",LEXK)) Q:'$L(LEXK)  S LEXARY(LEXK)=""
 Q
REP(X,LEXARY) ;   Repacement/Linked Keywords
 N LEXEXI,LEXLIEN,LEXSTR S LEXEXI=+($G(X)),LEXSTR="" I +LEXEXI>0 D
 . S LEXLIEN=0 F  S LEXLIEN=$O(^LEX(757.05,"AEXP",+LEXEXI,LEXLIEN)) Q:+LEXLIEN'>0  D
 . . Q:'$D(^LEX(757.05,+LEXLIEN,1,"B",+LEXEXI))  N LEXN,LEXT,LEXE,LEXA
 . . S LEXN=$G(^LEX(757.05,+LEXLIEN,0)),LEXT=$P(LEXN,"^",1),LEXE=$P(LEXN,"^",2),LEXA=$P(LEXN,"^",3)
 . . Q:LEXA'="L"  S:$L(LEXT) LEXARY(LEXT)=""
 Q
SET ;   Re-Index Subset file 757.21 (Set logic only)
 Q:'$D(LEXSET)  N LEXTC,LEXPRE,LEXBEG,LEXEND,LEXELP,LEXNM,LEXFI,LEXRT
 N LEXOUT,LEXMSG S LEXFI=757.21
 D FILE^DID(LEXFI,"N","GLOBAL NAME","LEXOUT","LEXMSG")
 S LEXRT=$G(LEXOUT("GLOBAL NAME")) Q:LEXRT'["^LEX"
 S LEXPRE=$G(^TMP("LEXRX",$J,"T",1,"ELAP"))
 S LEXBEG=$$NOW^XLFDT,LEXNM=$$FN^LEXRXXM(LEXFI)
 S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,("Re-Indexing File #"_LEXFI))
 Q:LEXTC=1  I '$D(ZTQUEUED) W !,?8,"Re-Indexing",!
 N LEXIEN,LEXP1,LEXP2,LEXP3,LEXP4 S (LEXP3,LEXP4,LEXIEN)=0
 S LEXP1=$P($G(^LEX(LEXFI,0)),"^",1),LEXP2=$P($G(^LEX(LEXFI,0)),"^",2)
 F  S LEXIEN=$O(^LEX(LEXFI,LEXIEN)) Q:+LEXIEN'>0  D
 . D:$D(LEXFIX) FIX(LEXIEN) I $D(^LEX(LEXFI,+LEXIEN,0)) S LEXP3=LEXIEN,LEXP4=LEXP4+1
 S:LEXP3>0 $P(^LEX(LEXFI,0),"^",3)=LEXP3 S:LEXP4>0 $P(^LEX(LEXFI,0),"^",4)=LEXP4
 I +($G(LEXP4))>0 N DIK S DIK="^LEX(757.21," D IXALL^DIK
 Q:$D(LEXQ)  H 1 S LEXEND=$$NOW^XLFDT,LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
 S:$E(LEXELP,1)=" "&($E(LEXELP,3)=":") LEXELP=$TR(LEXELP," ","0")
 D REP^LEXRXXS(LEXFI,LEXFI,"ALLIX",,,"Re-Index",LEXELP)
 S LEXELP=$$ADDT^LEXRXXM(LEXELP,LEXPRE)
 S ^TMP("LEXRX",$J,"T",1,"ELAP")=LEXELP
 Q
FIX(X) ;   Fix Deactivated Expressions in 757.21
 N DA,DIK,LEXEXP,LEXDFL Q:'$D(LEXFIX)  S DA=+($G(X)) Q:+DA'>0  Q:'$D(^LEX(757.21,+DA,0))
 S LEXEXP=+$G(^LEX(757.21,+DA,0)) Q:+LEXEXP'>0
 S LEXDFL=$P($G(^LEX(757.01,+LEXEXP,1)),"^",5) Q:+LEXDFL'>0
 I $D(LEXFIX) S DIK="^LEX(757.21," D ^DIK
 Q
TM(X,Y) ;   Trim Character Y - Default " "
 S X=$G(X) Q:X="" X  S Y=$G(Y) S:'$L(Y) Y=" " F  Q:$E(X,1)'=Y  S X=$E(X,2,$L(X))
 F  Q:$E(X,$L(X))'=Y  S X=$E(X,1,($L(X)-1))
 Q X
CLR ;   Clear
 N LEXFIX,LEXNAM,LEXQ,LEXSET,LEXTEST,ZTQUEUED,ZTREQ
 Q
DEA(X) ; Expression/Concept Deactive
 N LEXA,LEXEA,LEXEIEN,LEXMA,LEXMIEN,LEXN S LEXEIEN=+($G(X)),LEXN=$G(^LEX(757.01,+LEXEIEN,1))
 S LEXEA=+($P(LEXN,"^",5)),LEXMIEN=+LEXN,LEXN=+($P(LEXN,"^",2)) Q:LEXN=1&(LEXEA>0) 1  Q:LEXN=1&(LEXEA'>0) 0
 S LEXMIEN=+($G(^LEX(757,+LEXMIEN,0))),LEXMA=+($P($G(^LEX(757.01,+LEXMIEN,1)),"^",5)) Q:(LEXEA+LEXMA)>0 1
 Q 0