LEXRXC ;ISL/KER - Re-Index 757.01 B/ADC/ADTERM ;05/23/2017
;;2.0;LEXICON UTILITY;**81,80,86,103**;Sep 23, 1996;Build 2
;
; Global Variables
; ^LEX( SACC 1.3
; ^LEX(757.01) SACC 1.3
; ^TMP("LEXRX") SACC 2.3.2.5.1
;
; External References
; $$FMDIFF^XLFDT ICR 10103
; $$NOW^XLFDT ICR 10103
; $$UP^XLFSTR ICR 10104
; FILE^DID ICR 2052
; IXALL^DIK ICR 10013
;
; Local Variables NEWed or KILLed Elsewhere
; LEXNAM Task name NEWed/KILLed by LEXRXXT
; LEXSET Re-Index flag NEWed/KILLed by LEXRXXT
; LEXTEST Test variable NEWed/KILLed by Developer
; LEXQ Quiet flat NEWed/KILLed by LEXRXXT2
; ZTQUEUED Task flag NEWed/KILLed by Taskman
;
Q
; NOTES:
;
; The Major Concept Map file #757 is used to re-index
; the Expression file #757.01. hence file #757 must be
; repaired/re-indexed before file 757.01.
;
EN ; Main Entry Point
R75701 ; Repair file 757.01
D MC,RB,RADC,RADTERM,RAH,R75701^LEXRXC2,R75701^LEXRXC3
D:+($G(^TMP("LEXRX",$J,"ERR",757.01)))>0 SET
Q
RB ; Index ^LEX(757.01,"B",TXT,IEN)
; ^LEX(757.01,IEN,4,"B",NEG,IEN2)
; ^LEX(757.01,IEN,5,"B",WORD,IEN2)
S:$D(ZTQUEUED) ZTREQ="@" W:'$D(ZTQUEUED) ! N DA,DIK,LEXBEG,LEXDIF,LEXDF,LEXELP,LEXEND,LEXERR,LEXEXP,LEXFI,LEXIDX,LEXIDXT,LEXIDNT,LEXIDST
N LEXIEN,LEXMC,LEXNDS,LEXNDSN,LEXNDSS,LEXNER,LEXOK,LEXS,LEXSER,LEXSTR S LEXFI="757.01"
N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.01 ""B""") Q:LEXTC=1
S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXNDSN,LEXNDSS,LEXERR,LEXSER,LEXNER)=0,LEXSTR="",LEXFI="757.01",LEXIDX="B"
S LEXIDXT="^LEX(757.01,""B"",TXT,IEN)",LEXIDNT="^LEX(757.01,IEN,4,""B"",NEG,IEN2)",LEXIDST="^LEX(757.01,IEN,5,""B"",WORD,IEN2)"
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 I '$D(^LEX(LEXFI,LEXIEN,0)) D Q
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
. . N LEXOK,LEXEXP,LEXDF S LEXEXP=$$UP^XLFSTR($G(^LEX(LEXFI,LEXIEN,0)))
. . S LEXDF=+($P($G(^LEX(LEXFI,LEXIEN,1)),"^",5))
. . I $E(LEXEXP,1,63)'=LEXSTR,+LEXDF'>0 D
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . Q:'$L(LEXEXP) S:LEXDF'>0 ^LEX(LEXFI,LEXIDX,$E(LEXEXP,1,63),LEXIEN)=""
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,26),?58," ",LEXIEN
. . I +LEXDF>0 D
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,26),?58," ",LEXIEN," (-)"
. . I $D(^LEX(LEXFI,LEXIEN,4)) D
. . . N LEXSTR S LEXSTR="" F S LEXSTR=$O(^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR)) Q:'$L(LEXSTR) D
. . . . N LEXS S LEXS=0 F S LEXS=$O(^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR,LEXS)) Q:+LEXS'>0 D
. . . . . S LEXNDSN=LEXNDSN+1 N LEXOK,LEXMC S LEXMC=$G(^LEX(LEXFI,LEXIEN,4,LEXS,0))
. . . . . S LEXOK=0 S:LEXMC=LEXSTR LEXOK=1 I 'LEXOK D
. . . . . . S LEXNER=LEXNER+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR,LEXS)
. . . . . . S:$L(LEXMC) ^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXMC,LEXS)=""
. . . . . . I '$D(ZTQUEUED) W !,?10,757.17,?19,LEXIDX,?30,$E(LEXSTR,1,26),?58," ",LEXIEN,"/",LEXS
. . . S LEXSTR=0 F S LEXSTR=$O(^LEX(LEXFI,LEXIEN,4,LEXSTR)) Q:+LEXSTR'>0 D
. . . . N DA,X S X=$P($G(^LEX(LEXFI,LEXIEN,4,LEXSTR,0)),"^",1),DA(1)=LEXIEN,DA=LEXSTR
. . . . I $L(X) I '$D(^LEX(LEXFI,DA(1),4,LEXIDX,X,DA)) D Q
. . . . . S LEXNER=LEXNER+1,^LEX(LEXFI,DA(1),4,LEXIDX,X,DA)=""
. . . . . I '$D(ZTQUEUED) W !,?10,757.17,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
. . I $D(^LEX(LEXFI,LEXIEN,5)) D
. . . N LEXSTR S LEXSTR="" F S LEXSTR=$O(^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR)) Q:'$L(LEXSTR) D
. . . . N LEXS S LEXS=0 F S LEXS=$O(^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR,LEXS)) Q:+LEXS'>0 D
. . . . . S LEXNDSS=LEXNDSS+1 N LEXOK,LEXMC S LEXMC=$G(^LEX(LEXFI,LEXIEN,5,LEXS,0))
. . . . . S LEXOK=0 S:LEXMC=LEXSTR LEXOK=1 I 'LEXOK D
. . . . . . S LEXSER=LEXSER+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR,LEXS) S:$L(LEXMC) ^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXMC,LEXS)=""
. . . . . . I '$D(ZTQUEUED) W !,?10,757.18,?19,LEXIDX,?30,$E(LEXSTR,1,26),?58," ",LEXIEN,"/",LEXS
. . . S LEXSTR=0 F S LEXSTR=$O(^LEX(LEXFI,LEXIEN,5,LEXSTR)) Q:+LEXSTR'>0 D
. . . . N DA,X S X=$P($G(^LEX(LEXFI,LEXIEN,5,LEXSTR,0)),"^",1),DA(1)=LEXIEN,DA=LEXSTR
. . . . I $L(X) I '$D(^LEX(LEXFI,DA(1),5,LEXIDX,X,DA)) D Q
. . . . . S LEXSER=LEXSER+1,^LEX(LEXFI,DA(1),5,LEXIDX,X,DA)=""
. . . . . I '$D(ZTQUEUED) W !,?10,757.18,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
S LEXIEN=0 F S LEXIEN=$O(^LEX(LEXFI,LEXIEN)) Q:+LEXIEN'>0 D
. N DA,DIK,X,LEXDF S DA=LEXIEN,X=$$UP^XLFSTR($G(^LEX(LEXFI,LEXIEN,0))) Q:'$L(X)
. S LEXDF=+($P($G(^LEX(LEXFI,LEXIEN,1)),"^",5))
. I '$D(^LEX(LEXFI,"B",$E(X,1,63),DA))&(LEXDF'>0) D
. . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
. S:$L(X)&(LEXDF'>0) ^LEX(LEXFI,"B",$E(X,1,63),DA)=""
. N LEXS S LEXS=0 F S LEXS=$O(^LEX(LEXFI,LEXIEN,4,LEXS)) Q:+LEXS'>0 D
. . N DA,DIK,X S DA(1)=LEXIEN,DA=LEXS,X=$P($G(^LEX(LEXFI,DA(1),4,DA,0)),"^",1) Q:'$L(X)
. . I '$D(^LEX(LEXFI,DA(1),4,"B",X,DA)) D
. . . S LEXNER=LEXNER+1 I '$D(ZTQUEUED) W !,?10,757.17,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
. . S:$L(X) ^LEX(LEXFI,DA(1),4,"B",X,DA)=""
. S LEXS=0 F S LEXS=$O(^LEX(LEXFI,LEXIEN,5,LEXS)) Q:+LEXS'>0 D
. . N DA,DIK,X S DA(1)=LEXIEN,DA=LEXS,X=$P($G(^LEX(LEXFI,DA(1),5,DA,0)),"^",1) Q:'$L(X)
. . I '$D(^LEX(LEXFI,DA(1),5,"B",X,DA)) D
. . . S LEXSER=LEXSER+1 I '$D(ZTQUEUED) W !,?10,757.18,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
. . S:$L(X) ^LEX(LEXFI,DA(1),5,"B",X,DA)=""
S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
S LEXNER=$S(+LEXNER>0:LEXNER,1:"") I '$D(ZTQUEUED) W !,$J(LEXNER,5),?10,757.17,?19,LEXIDX,?30,LEXIDNT
S LEXSER=$S(+LEXSER>0:LEXSER,1:"") I '$D(ZTQUEUED) W !,$J(LEXSER,5),?10,757.18,?19,LEXIDX,?30,LEXIDST
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)
D REP^LEXRXXS(LEXFI,757.17,LEXIDX,LEXNDSN,LEXNER,LEXIDNT)
D REP^LEXRXXS(LEXFI,757.18,LEXIDX,LEXNDSS,LEXSER,LEXIDST)
Q
RADC ; Index ^LEX(757.01,"ADC",1,IEN)
S:$D(ZTQUEUED) ZTREQ="@" W:'$D(ZTQUEUED) ! N DA,DIK,LEXBEG,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXNDS,LEXOK,LEXSTR
S LEXFI="757.01"
N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.01 ""ADC""") Q:LEXTC=1
S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXERR)=0,LEXSTR="",LEXFI=757.01,LEXIDX="ADC",LEXIDXT="^LEX(757.01,""ADC"",1,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 I '$D(^LEX(LEXFI,LEXIEN,0)) D Q
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
. . N LEXOK,LEXDF S LEXDF=+($P($G(^LEX(LEXFI,LEXIEN,1)),"^",5))
. . S LEXOK=0 S:LEXDF=LEXSTR LEXOK=1 I 'LEXOK D
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN) S:$L(LEXDF) ^LEX(LEXFI,LEXIDX,LEXDF,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,1)),"^",5)
. I +X'>0,$D(^LEX(LEXFI,"ADC",+X,+DA)) D Q
. . S LEXERR=LEXERR+1
. . K:'$D(LEXTEST) ^LEX(LEXFI,"ADC",+X,+DA),^LEX(LEXFI,"ADC",1,+DA)
. . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (0)",?58," ",DA
. I +X>0,'$D(^LEX(LEXFI,"ADC",+X,+DA)) D Q
. . Q:+X'=1 S LEXERR=LEXERR+1
. . S:'$D(LEXTEST) ^LEX(LEXFI,"ADC",+X,+DA)=""
. . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
. S:+X>0 ^LEX(LEXFI,"ADC",+X,+DA)=""
. I +X>0,+X'=1 D Q
. . S LEXERR=LEXERR+1
. . K:'$D(LEXTEST) ^LEX(LEXFI,"ADC",+X,+DA)
. . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (>1)",?58," ",DA
. K:'$D(LEXTEST)&(+X'=1) ^LEX(LEXFI,"ADC",+X,+DA),^LEX(LEXFI,"ADC",1,+DA)
S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
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
RADTERM ; Index ^LEX(757.01,"ADTERM",DT,IEN)
S:$D(ZTQUEUED) ZTREQ="@" N DA,DIK,LEXBEG,LEXDE,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXNDS,LEXOK,LEXSTR
S LEXFI="757.01"
N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.01 ""ADTERM""") Q:LEXTC=1
S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXERR)=0,LEXSTR="",LEXFI=757.01,LEXIDX="ADTERM",LEXIDXT="^LEX(757.01,""ADTERM"",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 I '$D(^LEX(LEXFI,LEXIEN,0)) D Q
. . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
. . N LEXOK,LEXDF,LEXDE S LEXDF=+($P($G(^LEX(LEXFI,LEXIEN,1)),"^",5))
. . S LEXDE=$$UP^XLFSTR($E($P($G(^LEX(LEXFI,LEXIEN,0)),U,1),1,63))
. . I LEXDE'=LEXSTR,+LEXDF>0 D
. . . S LEXERR=LEXERR+1
. . . K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN) S ^LEX(LEXFI,LEXIDX,LEXDE,LEXIEN)=""
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,20),$S($L(LEXSTR)>20:"...",1:""),?58," ",LEXIEN
. . I +LEXDF'>0 D
. . . S LEXERR=LEXERR+1
. . . K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
. . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,20),$S($L(LEXSTR)>20:"...",1:""),?58," ",LEXIEN
S LEXIEN=0 F S LEXIEN=$O(^LEX(LEXFI,LEXIEN)) Q:+LEXIEN'>0 D
. N DA,DIK,LEXDF,X,UX S DA=LEXIEN,X=$P($G(^LEX(LEXFI,DA,0)),"^",1) Q:'$L(X)
. S UX=$$UP^XLFSTR(X) S LEXDF=+($P($G(^LEX(LEXFI,DA,1)),"^",5))
. I +LEXDF>0,'$D(^LEX(LEXFI,LEXIDX,$E(X,1,63),DA)) D
. . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
. I +LEXDF'>0,$D(^LEX(LEXFI,LEXIDX,$E(X,1,63),DA)) D
. . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (deleted)",?58," ",DA
. S:+LEXDF>0 ^LEX(LEXFI,LEXIDX,$E(UX,1,63),DA)=""
. K:+LEXDF'>0 ^LEX(LEXFI,LEXIDX,$E(X,1,63),DA),^LEX(LEXFI,LEXIDX,$E(UX,1,63),DA)
S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
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
RAH ; Index ^LEX(757.01,"AH",HA,IEN,IEN2)
S:$D(ZTQUEUED) ZTREQ="@" N DA,DIK,LEXBEG,LEXDE,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXEX,LEXEX2,LEXNDS,LEXOK,LEXSTR
S LEXFI="757.01"
N LEXTC S LEXTC=$$UPD^LEXRXXT3($G(LEXNAM),,"Repairing File #757.01 ""AH""") Q:LEXTC=1
S LEXBEG=$$NOW^XLFDT,(LEXNDS,LEXERR)=0,LEXSTR="",LEXFI=757.01,LEXIDX="AH",LEXIDXT="^LEX(757.01,""AH"",HA,IEN,IEN2)"
F S LEXSTR=$O(^LEX(LEXFI,LEXIDX,LEXSTR)) Q:'$L(LEXSTR) D
. N LEXEX S LEXEX=0 F S LEXEX=$O(^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX)) Q:+LEXEX'>0 D
. . N LEXEX2 S LEXEX2=0 F S LEXEX2=$O(^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2)) Q:+LEXEX2'>0 D
. . . N LEXND,LEXHA S LEXND=$G(^LEX(LEXFI,LEXEX,7,LEXEX2,0)),LEXHA=$P(LEXND,"^",3)
. . . S LEXNDS=LEXNDS+1 I '$D(^LEX(LEXFI,LEXEX,7,LEXEX2,0)) D Q
. . . . S LEXERR=LEXERR+1 K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2)
. . . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXEX
. . . I $L(LEXHA),LEXSTR'=LEXHA D
. . . . S LEXERR=LEXERR+1
. . . . K:'$D(LEXTEST) ^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2) S ^LEX(LEXFI,LEXIDX,LEXHA,LEXEX,LEXEX2)=""
. . . . I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,$E(LEXSTR,1,20),$S($L(LEXSTR)>20:"...",1:""),?58," ",LEXEX
S LEXEX=0 F S LEXEX=$O(^LEX(LEXFI,LEXEX)) Q:+LEXEX'>0 D
. N LEXEX2 S LEXEX2=0 F S LEXEX2=$O(^LEX(LEXFI,LEXEX,7,LEXEX2)) Q:+LEXEX2'>0 D
. . N DA,DIK,LEXND,LEXHA,X S DA(1)=LEXEX,DA=LEXEX2,LEXND=$G(^LEX(LEXFI,DA(1),7,DA,0))
. . S (X,LEXHA)=$P(LEXND,"^",3) Q:'$L(LEXHA)
. . I '$D(^LEX(LEXFI,LEXIDX,X,DA(1),DA)) D
. . . S LEXERR=LEXERR+1 I '$D(ZTQUEUED) W !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA(1)
. . S:$L(X) ^LEX(LEXFI,LEXIDX,X,DA(1),DA)=""
S LEXERR=$S(+LEXERR>0:LEXERR,1:"") I '$D(ZTQUEUED) W !,$J(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
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
;
; Miscellaneous
SET ; Re-Index (some indexes in file 757.01, set logic only)
S:$D(ZTQUEUED) ZTREQ="@" Q:'$D(LEXSET) N LEXTC,LEXPRE,LEXBEG,LEXEND,LEXELP,LEXNM,LEXFI,LEXRT,LEXIEN,LEXP3,LEXP4
N LEXOUT,LEXMSG,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE S LEXFI=757.01
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 1 D
. N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE S ZTRTN="SETIX^LEXRXC" S ZTDESC="Set 757.01 Indexes"
. S ZTSAVE("LEXRT")="",ZTSAVE("LEXFI")="",ZTIO="",ZTDTH=$H D ^%ZTLOAD
Q:$D(LEXQ) 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
SETIX ; Set Indexes (Set logic only)
S:$D(ZTQUEUED) ZTREQ="@" W:'$D(ZTQUEUED) !,?8,"Re-Indexing",! N DIK,LEXP3,LEXP4,LEXIEN
S DIK="^LEX(757.01,",DIK(1)=".01^B" D ENALL^DIK S DIK="^LEX(757.01,",DIK(1)="1^AMC" D ENALL^DIK
S DIK="^LEX(757.01,",DIK(1)="9^ADC^ADTERM" D ENALL^DIK S DIK="^LEX(757.01,",DIK(1)="13^APAR" D ENALL^DIK
F S LEXIEN=$O(^LEX(757.01,LEXIEN)) Q:+LEXIEN'>0 S LEXP3=LEXIEN,LEXP4=LEXP4+1
S $P(^LEX(757.01,0),"^",3)=LEXP3,$P(^LEX(757.01,0),"^",4)=LEXP4
Q
DL ; De-Link AWRD
N LEXIEN S LEXIEN=0 F S LEXIEN=$O(^LEX(757.05,LEXIEN)) Q:+LEXIEN'>0 D
. N LEXNC,LEXND,LEXNN,LEXWRD S LEXND=$G(^LEX(757.05,+LEXIEN,0)) Q:$P(LEXND,"^",3)'="L" S LEXWRD=$P(LEXND,"^",1)
. S LEXNN="^LEX(757.01,""AWRD"","""_LEXWRD_""")",LEXNC="^LEX(757.01,""AWRD"","""_LEXWRD_""","
. F S LEXNN=$Q(@LEXNN) Q:'$L(LEXNN)!(LEXNN'[LEXNC) K:LEXNN[",""LINKED"")" @LEXNN
Q
MC ; Major Concept Map File
N DIK S DIK="^LEX(757," D IXALL^DIK
Q
RL ; Re-Link 757.05
N LEX,DIK S LEX=" " F S LEX=$O(^LEX(757.05,LEX)) Q:'$L(LEX) K:LEX?1U.U ^LEX(757.05,LEX)
S DIK="^LEX(757.05," D IXALL^DIK
Q
SL ; String Length ASL
N LEXSTR S LEXSTR="" F S LEXSTR=$O(^LEX(757.01,"ASL",LEXSTR)) Q:'$L(LEXSTR) D
. N LEXSCT,LEXPSCT S LEXSCT=$$SCT^LEXRXC3(LEXSTR)
. S LEXPSCT=$O(^LEX(757.01,"ASL",LEXSTR,0))
. I +LEXPSCT>0,+LEXSCT'>0 K ^LEX(757.01,"ASL",LEXSTR,+LEXPSCT)
. I +LEXPSCT>0,+LEXSCT>0,+LEXPSCT'=LEXSCT D
. . K ^LEX(757.01,"ASL",LEXSTR,+LEXPSCT) S ^LEX(757.01,"ASL",LEXSTR,+LEXSCT)=""
Q
CLR ; Clear
K LEXNAM,LEXSET,LEXTEST,ZTQUEUED,LEXQ
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLEXRXC 15789 printed Dec 13, 2024@02:09:12 Page 2
LEXRXC ;ISL/KER - Re-Index 757.01 B/ADC/ADTERM ;05/23/2017
+1 ;;2.0;LEXICON UTILITY;**81,80,86,103**;Sep 23, 1996;Build 2
+2 ;
+3 ; Global Variables
+4 ; ^LEX( SACC 1.3
+5 ; ^LEX(757.01) SACC 1.3
+6 ; ^TMP("LEXRX") SACC 2.3.2.5.1
+7 ;
+8 ; External References
+9 ; $$FMDIFF^XLFDT ICR 10103
+10 ; $$NOW^XLFDT ICR 10103
+11 ; $$UP^XLFSTR ICR 10104
+12 ; FILE^DID ICR 2052
+13 ; IXALL^DIK ICR 10013
+14 ;
+15 ; Local Variables NEWed or KILLed Elsewhere
+16 ; LEXNAM Task name NEWed/KILLed by LEXRXXT
+17 ; LEXSET Re-Index flag NEWed/KILLed by LEXRXXT
+18 ; LEXTEST Test variable NEWed/KILLed by Developer
+19 ; LEXQ Quiet flat NEWed/KILLed by LEXRXXT2
+20 ; ZTQUEUED Task flag NEWed/KILLed by Taskman
+21 ;
+22 QUIT
+23 ; NOTES:
+24 ;
+25 ; The Major Concept Map file #757 is used to re-index
+26 ; the Expression file #757.01. hence file #757 must be
+27 ; repaired/re-indexed before file 757.01.
+28 ;
EN ; Main Entry Point
R75701 ; Repair file 757.01
+1 DO MC
DO RB
DO RADC
DO RADTERM
DO RAH
DO R75701^LEXRXC2
DO R75701^LEXRXC3
+2 if +($GET(^TMP("LEXRX",$JOB,"ERR",757.01)))>0
DO SET
+3 QUIT
RB ; Index ^LEX(757.01,"B",TXT,IEN)
+1 ; ^LEX(757.01,IEN,4,"B",NEG,IEN2)
+2 ; ^LEX(757.01,IEN,5,"B",WORD,IEN2)
+3 if $DATA(ZTQUEUED)
SET ZTREQ="@"
if '$DATA(ZTQUEUED)
WRITE !
NEW DA,DIK,LEXBEG,LEXDIF,LEXDF,LEXELP,LEXEND,LEXERR,LEXEXP,LEXFI,LEXIDX,LEXIDXT,LEXIDNT,LEXIDST
+4 NEW LEXIEN,LEXMC,LEXNDS,LEXNDSN,LEXNDSS,LEXNER,LEXOK,LEXS,LEXSER,LEXSTR
SET LEXFI="757.01"
+5 NEW LEXTC
SET LEXTC=$$UPD^LEXRXXT3($GET(LEXNAM),,"Repairing File #757.01 ""B""")
if LEXTC=1
QUIT
+6 SET LEXBEG=$$NOW^XLFDT
SET (LEXNDS,LEXNDSN,LEXNDSS,LEXERR,LEXSER,LEXNER)=0
SET LEXSTR=""
SET LEXFI="757.01"
SET LEXIDX="B"
+7 SET LEXIDXT="^LEX(757.01,""B"",TXT,IEN)"
SET LEXIDNT="^LEX(757.01,IEN,4,""B"",NEG,IEN2)"
SET LEXIDST="^LEX(757.01,IEN,5,""B"",WORD,IEN2)"
+8 FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:1
+9 NEW LEXIEN
SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:2
+10 SET LEXNDS=LEXNDS+1
IF '$DATA(^LEX(LEXFI,LEXIEN,0))
Begin DoDot:3
+11 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+12 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
End DoDot:3
QUIT
+13 NEW LEXOK,LEXEXP,LEXDF
SET LEXEXP=$$UP^XLFSTR($GET(^LEX(LEXFI,LEXIEN,0)))
+14 SET LEXDF=+($PIECE($GET(^LEX(LEXFI,LEXIEN,1)),"^",5))
+15 IF $EXTRACT(LEXEXP,1,63)'=LEXSTR
IF +LEXDF'>0
Begin DoDot:3
+16 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+17 if '$LENGTH(LEXEXP)
QUIT
if LEXDF'>0
SET ^LEX(LEXFI,LEXIDX,$EXTRACT(LEXEXP,1,63),LEXIEN)=""
+18 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,26),?58," ",LEXIEN
End DoDot:3
+19 IF +LEXDF>0
Begin DoDot:3
+20 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+21 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,26),?58," ",LEXIEN," (-)"
End DoDot:3
+22 IF $DATA(^LEX(LEXFI,LEXIEN,4))
Begin DoDot:3
+23 NEW LEXSTR
SET LEXSTR=""
FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:4
+24 NEW LEXS
SET LEXS=0
FOR
SET LEXS=$ORDER(^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR,LEXS))
if +LEXS'>0
QUIT
Begin DoDot:5
+25 SET LEXNDSN=LEXNDSN+1
NEW LEXOK,LEXMC
SET LEXMC=$GET(^LEX(LEXFI,LEXIEN,4,LEXS,0))
+26 SET LEXOK=0
if LEXMC=LEXSTR
SET LEXOK=1
IF 'LEXOK
Begin DoDot:6
+27 SET LEXNER=LEXNER+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXSTR,LEXS)
+28 if $LENGTH(LEXMC)
SET ^LEX(LEXFI,LEXIEN,4,LEXIDX,LEXMC,LEXS)=""
+29 IF '$DATA(ZTQUEUED)
WRITE !,?10,757.17,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,26),?58," ",LEXIEN,"/",LEXS
End DoDot:6
End DoDot:5
End DoDot:4
+30 SET LEXSTR=0
FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIEN,4,LEXSTR))
if +LEXSTR'>0
QUIT
Begin DoDot:4
+31 NEW DA,X
SET X=$PIECE($GET(^LEX(LEXFI,LEXIEN,4,LEXSTR,0)),"^",1)
SET DA(1)=LEXIEN
SET DA=LEXSTR
+32 IF $LENGTH(X)
IF '$DATA(^LEX(LEXFI,DA(1),4,LEXIDX,X,DA))
Begin DoDot:5
+33 SET LEXNER=LEXNER+1
SET ^LEX(LEXFI,DA(1),4,LEXIDX,X,DA)=""
+34 IF '$DATA(ZTQUEUED)
WRITE !,?10,757.17,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
End DoDot:5
QUIT
End DoDot:4
End DoDot:3
+35 IF $DATA(^LEX(LEXFI,LEXIEN,5))
Begin DoDot:3
+36 NEW LEXSTR
SET LEXSTR=""
FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:4
+37 NEW LEXS
SET LEXS=0
FOR
SET LEXS=$ORDER(^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR,LEXS))
if +LEXS'>0
QUIT
Begin DoDot:5
+38 SET LEXNDSS=LEXNDSS+1
NEW LEXOK,LEXMC
SET LEXMC=$GET(^LEX(LEXFI,LEXIEN,5,LEXS,0))
+39 SET LEXOK=0
if LEXMC=LEXSTR
SET LEXOK=1
IF 'LEXOK
Begin DoDot:6
+40 SET LEXSER=LEXSER+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXSTR,LEXS)
if $LENGTH(LEXMC)
SET ^LEX(LEXFI,LEXIEN,5,LEXIDX,LEXMC,LEXS)=""
+41 IF '$DATA(ZTQUEUED)
WRITE !,?10,757.18,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,26),?58," ",LEXIEN,"/",LEXS
End DoDot:6
End DoDot:5
End DoDot:4
+42 SET LEXSTR=0
FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIEN,5,LEXSTR))
if +LEXSTR'>0
QUIT
Begin DoDot:4
+43 NEW DA,X
SET X=$PIECE($GET(^LEX(LEXFI,LEXIEN,5,LEXSTR,0)),"^",1)
SET DA(1)=LEXIEN
SET DA=LEXSTR
+44 IF $LENGTH(X)
IF '$DATA(^LEX(LEXFI,DA(1),5,LEXIDX,X,DA))
Begin DoDot:5
+45 SET LEXSER=LEXSER+1
SET ^LEX(LEXFI,DA(1),5,LEXIDX,X,DA)=""
+46 IF '$DATA(ZTQUEUED)
WRITE !,?10,757.18,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
End DoDot:5
QUIT
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+47 SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:1
+48 NEW DA,DIK,X,LEXDF
SET DA=LEXIEN
SET X=$$UP^XLFSTR($GET(^LEX(LEXFI,LEXIEN,0)))
if '$LENGTH(X)
QUIT
+49 SET LEXDF=+($PIECE($GET(^LEX(LEXFI,LEXIEN,1)),"^",5))
+50 IF '$DATA(^LEX(LEXFI,"B",$EXTRACT(X,1,63),DA))&(LEXDF'>0)
Begin DoDot:2
+51 SET LEXERR=LEXERR+1
IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
End DoDot:2
+52 if $LENGTH(X)&(LEXDF'>0)
SET ^LEX(LEXFI,"B",$EXTRACT(X,1,63),DA)=""
+53 NEW LEXS
SET LEXS=0
FOR
SET LEXS=$ORDER(^LEX(LEXFI,LEXIEN,4,LEXS))
if +LEXS'>0
QUIT
Begin DoDot:2
+54 NEW DA,DIK,X
SET DA(1)=LEXIEN
SET DA=LEXS
SET X=$PIECE($GET(^LEX(LEXFI,DA(1),4,DA,0)),"^",1)
if '$LENGTH(X)
QUIT
+55 IF '$DATA(^LEX(LEXFI,DA(1),4,"B",X,DA))
Begin DoDot:3
+56 SET LEXNER=LEXNER+1
IF '$DATA(ZTQUEUED)
WRITE !,?10,757.17,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
End DoDot:3
+57 if $LENGTH(X)
SET ^LEX(LEXFI,DA(1),4,"B",X,DA)=""
End DoDot:2
+58 SET LEXS=0
FOR
SET LEXS=$ORDER(^LEX(LEXFI,LEXIEN,5,LEXS))
if +LEXS'>0
QUIT
Begin DoDot:2
+59 NEW DA,DIK,X
SET DA(1)=LEXIEN
SET DA=LEXS
SET X=$PIECE($GET(^LEX(LEXFI,DA(1),5,DA,0)),"^",1)
if '$LENGTH(X)
QUIT
+60 IF '$DATA(^LEX(LEXFI,DA(1),5,"B",X,DA))
Begin DoDot:3
+61 SET LEXSER=LEXSER+1
IF '$DATA(ZTQUEUED)
WRITE !,?10,757.18,?19,LEXIDX,?30,"Missing",?58," ",DA(1),"/",DA
End DoDot:3
+62 if $LENGTH(X)
SET ^LEX(LEXFI,DA(1),5,"B",X,DA)=""
End DoDot:2
End DoDot:1
+63 SET LEXERR=$SELECT(+LEXERR>0:LEXERR,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
+64 SET LEXNER=$SELECT(+LEXNER>0:LEXNER,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXNER,5),?10,757.17,?19,LEXIDX,?30,LEXIDNT
+65 SET LEXSER=$SELECT(+LEXSER>0:LEXSER,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXSER,5),?10,757.18,?19,LEXIDX,?30,LEXIDST
+66 SET LEXEND=$$NOW^XLFDT
SET LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
+67 if $EXTRACT(LEXELP,1)=" "&($EXTRACT(LEXELP,3)="
SET LEXELP=$TRANSLATE(LEXELP," ","0")
+68 DO REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
+69 DO REP^LEXRXXS(LEXFI,757.17,LEXIDX,LEXNDSN,LEXNER,LEXIDNT)
+70 DO REP^LEXRXXS(LEXFI,757.18,LEXIDX,LEXNDSS,LEXSER,LEXIDST)
+71 QUIT
RADC ; Index ^LEX(757.01,"ADC",1,IEN)
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
if '$DATA(ZTQUEUED)
WRITE !
NEW DA,DIK,LEXBEG,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXNDS,LEXOK,LEXSTR
+2 SET LEXFI="757.01"
+3 NEW LEXTC
SET LEXTC=$$UPD^LEXRXXT3($GET(LEXNAM),,"Repairing File #757.01 ""ADC""")
if LEXTC=1
QUIT
+4 SET LEXBEG=$$NOW^XLFDT
SET (LEXNDS,LEXERR)=0
SET LEXSTR=""
SET LEXFI=757.01
SET LEXIDX="ADC"
SET LEXIDXT="^LEX(757.01,""ADC"",1,IEN)"
+5 FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:1
+6 NEW LEXIEN
SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:2
+7 SET LEXNDS=LEXNDS+1
IF '$DATA(^LEX(LEXFI,LEXIEN,0))
Begin DoDot:3
+8 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+9 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
End DoDot:3
QUIT
+10 NEW LEXOK,LEXDF
SET LEXDF=+($PIECE($GET(^LEX(LEXFI,LEXIEN,1)),"^",5))
+11 SET LEXOK=0
if LEXDF=LEXSTR
SET LEXOK=1
IF 'LEXOK
Begin DoDot:3
+12 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
if $LENGTH(LEXDF)
SET ^LEX(LEXFI,LEXIDX,LEXDF,LEXIEN)=""
+13 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
End DoDot:3
End DoDot:2
End DoDot:1
+14 SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:1
+15 NEW DA,DIK,X
SET DA=LEXIEN
SET X=$PIECE($GET(^LEX(LEXFI,+DA,1)),"^",5)
+16 IF +X'>0
IF $DATA(^LEX(LEXFI,"ADC",+X,+DA))
Begin DoDot:2
+17 SET LEXERR=LEXERR+1
+18 if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,"ADC",+X,+DA),^LEX(LEXFI,"ADC",1,+DA)
+19 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (0)",?58," ",DA
End DoDot:2
QUIT
+20 IF +X>0
IF '$DATA(^LEX(LEXFI,"ADC",+X,+DA))
Begin DoDot:2
+21 if +X'=1
QUIT
SET LEXERR=LEXERR+1
+22 if '$DATA(LEXTEST)
SET ^LEX(LEXFI,"ADC",+X,+DA)=""
+23 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
End DoDot:2
QUIT
+24 if +X>0
SET ^LEX(LEXFI,"ADC",+X,+DA)=""
+25 IF +X>0
IF +X'=1
Begin DoDot:2
+26 SET LEXERR=LEXERR+1
+27 if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,"ADC",+X,+DA)
+28 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (>1)",?58," ",DA
End DoDot:2
QUIT
+29 if '$DATA(LEXTEST)&(+X'=1)
KILL ^LEX(LEXFI,"ADC",+X,+DA),^LEX(LEXFI,"ADC",1,+DA)
End DoDot:1
+30 SET LEXERR=$SELECT(+LEXERR>0:LEXERR,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
+31 SET LEXEND=$$NOW^XLFDT
SET LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
+32 if $EXTRACT(LEXELP,1)=" "&($EXTRACT(LEXELP,3)="
SET LEXELP=$TRANSLATE(LEXELP," ","0")
+33 DO REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
+34 QUIT
RADTERM ; Index ^LEX(757.01,"ADTERM",DT,IEN)
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
NEW DA,DIK,LEXBEG,LEXDE,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXIEN,LEXNDS,LEXOK,LEXSTR
+2 SET LEXFI="757.01"
+3 NEW LEXTC
SET LEXTC=$$UPD^LEXRXXT3($GET(LEXNAM),,"Repairing File #757.01 ""ADTERM""")
if LEXTC=1
QUIT
+4 SET LEXBEG=$$NOW^XLFDT
SET (LEXNDS,LEXERR)=0
SET LEXSTR=""
SET LEXFI=757.01
SET LEXIDX="ADTERM"
SET LEXIDXT="^LEX(757.01,""ADTERM"",EXP,IEN)"
+5 FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:1
+6 NEW LEXIEN
SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:2
+7 SET LEXNDS=LEXNDS+1
IF '$DATA(^LEX(LEXFI,LEXIEN,0))
Begin DoDot:3
+8 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+9 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXIEN
End DoDot:3
QUIT
+10 NEW LEXOK,LEXDF,LEXDE
SET LEXDF=+($PIECE($GET(^LEX(LEXFI,LEXIEN,1)),"^",5))
+11 SET LEXDE=$$UP^XLFSTR($EXTRACT($PIECE($GET(^LEX(LEXFI,LEXIEN,0)),U,1),1,63))
+12 IF LEXDE'=LEXSTR
IF +LEXDF>0
Begin DoDot:3
+13 SET LEXERR=LEXERR+1
+14 if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
SET ^LEX(LEXFI,LEXIDX,LEXDE,LEXIEN)=""
+15 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,20),$SELECT($LENGTH(LEXSTR)>20:"...",1:""),?58," ",LEXIEN
End DoDot:3
+16 IF +LEXDF'>0
Begin DoDot:3
+17 SET LEXERR=LEXERR+1
+18 if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXIEN)
+19 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,20),$SELECT($LENGTH(LEXSTR)>20:"...",1:""),?58," ",LEXIEN
End DoDot:3
End DoDot:2
End DoDot:1
+20 SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(LEXFI,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:1
+21 NEW DA,DIK,LEXDF,X,UX
SET DA=LEXIEN
SET X=$PIECE($GET(^LEX(LEXFI,DA,0)),"^",1)
if '$LENGTH(X)
QUIT
+22 SET UX=$$UP^XLFSTR(X)
SET LEXDF=+($PIECE($GET(^LEX(LEXFI,DA,1)),"^",5))
+23 IF +LEXDF>0
IF '$DATA(^LEX(LEXFI,LEXIDX,$EXTRACT(X,1,63),DA))
Begin DoDot:2
+24 SET LEXERR=LEXERR+1
IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA
End DoDot:2
+25 IF +LEXDF'>0
IF $DATA(^LEX(LEXFI,LEXIDX,$EXTRACT(X,1,63),DA))
Begin DoDot:2
+26 SET LEXERR=LEXERR+1
IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Invalid (deleted)",?58," ",DA
End DoDot:2
+27 if +LEXDF>0
SET ^LEX(LEXFI,LEXIDX,$EXTRACT(UX,1,63),DA)=""
+28 if +LEXDF'>0
KILL ^LEX(LEXFI,LEXIDX,$EXTRACT(X,1,63),DA),^LEX(LEXFI,LEXIDX,$EXTRACT(UX,1,63),DA)
End DoDot:1
+29 SET LEXERR=$SELECT(+LEXERR>0:LEXERR,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
+30 SET LEXEND=$$NOW^XLFDT
SET LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
+31 if $EXTRACT(LEXELP,1)=" "&($EXTRACT(LEXELP,3)="
SET LEXELP=$TRANSLATE(LEXELP," ","0")
+32 DO REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
+33 QUIT
RAH ; Index ^LEX(757.01,"AH",HA,IEN,IEN2)
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
NEW DA,DIK,LEXBEG,LEXDE,LEXDF,LEXDIF,LEXELP,LEXEND,LEXERR,LEXFI,LEXIDX,LEXIDXT,LEXEX,LEXEX2,LEXNDS,LEXOK,LEXSTR
+2 SET LEXFI="757.01"
+3 NEW LEXTC
SET LEXTC=$$UPD^LEXRXXT3($GET(LEXNAM),,"Repairing File #757.01 ""AH""")
if LEXTC=1
QUIT
+4 SET LEXBEG=$$NOW^XLFDT
SET (LEXNDS,LEXERR)=0
SET LEXSTR=""
SET LEXFI=757.01
SET LEXIDX="AH"
SET LEXIDXT="^LEX(757.01,""AH"",HA,IEN,IEN2)"
+5 FOR
SET LEXSTR=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:1
+6 NEW LEXEX
SET LEXEX=0
FOR
SET LEXEX=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX))
if +LEXEX'>0
QUIT
Begin DoDot:2
+7 NEW LEXEX2
SET LEXEX2=0
FOR
SET LEXEX2=$ORDER(^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2))
if +LEXEX2'>0
QUIT
Begin DoDot:3
+8 NEW LEXND,LEXHA
SET LEXND=$GET(^LEX(LEXFI,LEXEX,7,LEXEX2,0))
SET LEXHA=$PIECE(LEXND,"^",3)
+9 SET LEXNDS=LEXNDS+1
IF '$DATA(^LEX(LEXFI,LEXEX,7,LEXEX2,0))
Begin DoDot:4
+10 SET LEXERR=LEXERR+1
if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2)
+11 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,LEXSTR,?58," ",LEXEX
End DoDot:4
QUIT
+12 IF $LENGTH(LEXHA)
IF LEXSTR'=LEXHA
Begin DoDot:4
+13 SET LEXERR=LEXERR+1
+14 if '$DATA(LEXTEST)
KILL ^LEX(LEXFI,LEXIDX,LEXSTR,LEXEX,LEXEX2)
SET ^LEX(LEXFI,LEXIDX,LEXHA,LEXEX,LEXEX2)=""
+15 IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,$EXTRACT(LEXSTR,1,20),$SELECT($LENGTH(LEXSTR)>20:"...",1:""),?58," ",LEXEX
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+16 SET LEXEX=0
FOR
SET LEXEX=$ORDER(^LEX(LEXFI,LEXEX))
if +LEXEX'>0
QUIT
Begin DoDot:1
+17 NEW LEXEX2
SET LEXEX2=0
FOR
SET LEXEX2=$ORDER(^LEX(LEXFI,LEXEX,7,LEXEX2))
if +LEXEX2'>0
QUIT
Begin DoDot:2
+18 NEW DA,DIK,LEXND,LEXHA,X
SET DA(1)=LEXEX
SET DA=LEXEX2
SET LEXND=$GET(^LEX(LEXFI,DA(1),7,DA,0))
+19 SET (X,LEXHA)=$PIECE(LEXND,"^",3)
if '$LENGTH(LEXHA)
QUIT
+20 IF '$DATA(^LEX(LEXFI,LEXIDX,X,DA(1),DA))
Begin DoDot:3
+21 SET LEXERR=LEXERR+1
IF '$DATA(ZTQUEUED)
WRITE !,?8,LEXFI,?19,LEXIDX,?30,"Missing",?58," ",DA(1)
End DoDot:3
+22 if $LENGTH(X)
SET ^LEX(LEXFI,LEXIDX,X,DA(1),DA)=""
End DoDot:2
End DoDot:1
+23 SET LEXERR=$SELECT(+LEXERR>0:LEXERR,1:"")
IF '$DATA(ZTQUEUED)
WRITE !,$JUSTIFY(LEXERR,5),?8,LEXFI,?19,LEXIDX,?30,LEXIDXT
+24 SET LEXEND=$$NOW^XLFDT
SET LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
+25 if $EXTRACT(LEXELP,1)=" "&($EXTRACT(LEXELP,3)="
SET LEXELP=$TRANSLATE(LEXELP," ","0")
+26 DO REP^LEXRXXS(LEXFI,LEXFI,LEXIDX,LEXNDS,LEXERR,LEXIDXT,LEXELP)
+27 QUIT
+28 ;
+29 ; Miscellaneous
SET ; Re-Index (some indexes in file 757.01, set logic only)
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
if '$DATA(LEXSET)
QUIT
NEW LEXTC,LEXPRE,LEXBEG,LEXEND,LEXELP,LEXNM,LEXFI,LEXRT,LEXIEN,LEXP3,LEXP4
+2 NEW LEXOUT,LEXMSG,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
SET LEXFI=757.01
+3 DO FILE^DID(LEXFI,"N","GLOBAL NAME","LEXOUT","LEXMSG")
SET LEXRT=$GET(LEXOUT("GLOBAL NAME"))
if LEXRT'["^LEX"
QUIT
+4 SET LEXPRE=$GET(^TMP("LEXRX",$JOB,"T",1,"ELAP"))
+5 SET LEXBEG=$$NOW^XLFDT
SET LEXNM=$$FN^LEXRXXM(LEXFI)
+6 SET LEXTC=$$UPD^LEXRXXT3($GET(LEXNAM),,("Re-Indexing File #"_LEXFI))
if LEXTC=1
QUIT
IF 1
Begin DoDot:1
+7 NEW ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE
SET ZTRTN="SETIX^LEXRXC"
SET ZTDESC="Set 757.01 Indexes"
+8 SET ZTSAVE("LEXRT")=""
SET ZTSAVE("LEXFI")=""
SET ZTIO=""
SET ZTDTH=$HOROLOG
DO ^%ZTLOAD
End DoDot:1
+9 if $DATA(LEXQ)
QUIT
SET LEXEND=$$NOW^XLFDT
SET LEXELP=$$FMDIFF^XLFDT(LEXEND,LEXBEG,3)
+10 if $EXTRACT(LEXELP,1)=" "&($EXTRACT(LEXELP,3)="
SET LEXELP=$TRANSLATE(LEXELP," ","0")
+11 DO REP^LEXRXXS(LEXFI,LEXFI,"ALLIX",,,"Re-Index",LEXELP)
+12 SET LEXELP=$$ADDT^LEXRXXM(LEXELP,LEXPRE)
+13 SET ^TMP("LEXRX",$JOB,"T",1,"ELAP")=LEXELP
+14 QUIT
SETIX ; Set Indexes (Set logic only)
+1 if $DATA(ZTQUEUED)
SET ZTREQ="@"
if '$DATA(ZTQUEUED)
WRITE !,?8,"Re-Indexing",!
NEW DIK,LEXP3,LEXP4,LEXIEN
+2 SET DIK="^LEX(757.01,"
SET DIK(1)=".01^B"
DO ENALL^DIK
SET DIK="^LEX(757.01,"
SET DIK(1)="1^AMC"
DO ENALL^DIK
+3 SET DIK="^LEX(757.01,"
SET DIK(1)="9^ADC^ADTERM"
DO ENALL^DIK
SET DIK="^LEX(757.01,"
SET DIK(1)="13^APAR"
DO ENALL^DIK
+4 FOR
SET LEXIEN=$ORDER(^LEX(757.01,LEXIEN))
if +LEXIEN'>0
QUIT
SET LEXP3=LEXIEN
SET LEXP4=LEXP4+1
+5 SET $PIECE(^LEX(757.01,0),"^",3)=LEXP3
SET $PIECE(^LEX(757.01,0),"^",4)=LEXP4
+6 QUIT
DL ; De-Link AWRD
+1 NEW LEXIEN
SET LEXIEN=0
FOR
SET LEXIEN=$ORDER(^LEX(757.05,LEXIEN))
if +LEXIEN'>0
QUIT
Begin DoDot:1
+2 NEW LEXNC,LEXND,LEXNN,LEXWRD
SET LEXND=$GET(^LEX(757.05,+LEXIEN,0))
if $PIECE(LEXND,"^",3)'="L"
QUIT
SET LEXWRD=$PIECE(LEXND,"^",1)
+3 SET LEXNN="^LEX(757.01,""AWRD"","""_LEXWRD_""")"
SET LEXNC="^LEX(757.01,""AWRD"","""_LEXWRD_""","
+4 FOR
SET LEXNN=$QUERY(@LEXNN)
if '$LENGTH(LEXNN)!(LEXNN'[LEXNC)
QUIT
if LEXNN[",""LINKED"")"
KILL @LEXNN
End DoDot:1
+5 QUIT
MC ; Major Concept Map File
+1 NEW DIK
SET DIK="^LEX(757,"
DO IXALL^DIK
+2 QUIT
RL ; Re-Link 757.05
+1 NEW LEX,DIK
SET LEX=" "
FOR
SET LEX=$ORDER(^LEX(757.05,LEX))
if '$LENGTH(LEX)
QUIT
if LEX?1U.U
KILL ^LEX(757.05,LEX)
+2 SET DIK="^LEX(757.05,"
DO IXALL^DIK
+3 QUIT
SL ; String Length ASL
+1 NEW LEXSTR
SET LEXSTR=""
FOR
SET LEXSTR=$ORDER(^LEX(757.01,"ASL",LEXSTR))
if '$LENGTH(LEXSTR)
QUIT
Begin DoDot:1
+2 NEW LEXSCT,LEXPSCT
SET LEXSCT=$$SCT^LEXRXC3(LEXSTR)
+3 SET LEXPSCT=$ORDER(^LEX(757.01,"ASL",LEXSTR,0))
+4 IF +LEXPSCT>0
IF +LEXSCT'>0
KILL ^LEX(757.01,"ASL",LEXSTR,+LEXPSCT)
+5 IF +LEXPSCT>0
IF +LEXSCT>0
IF +LEXPSCT'=LEXSCT
Begin DoDot:2
+6 KILL ^LEX(757.01,"ASL",LEXSTR,+LEXPSCT)
SET ^LEX(757.01,"ASL",LEXSTR,+LEXSCT)=""
End DoDot:2
End DoDot:1
+7 QUIT
CLR ; Clear
+1 KILL LEXNAM,LEXSET,LEXTEST,ZTQUEUED,LEXQ
+2 QUIT