LEXRXXT ;ISL/KER - Repair/Re-Index - Task ;05/23/2017
;;2.0;LEXICON UTILITY;**81,103**;Sep 23, 1996;Build 2
;
; Global Variables
; ^LEX( SACC 1.3
; ^LEXT( SACC 1.3
; ^TMP("LEXRX",$J) SACC 2.3.2.5.1
; ^XTMP("LEXRX") SACC 2.3.2.5.2
;
; External References
; HOME^%ZIS ICR 10086
; ^%ZTLOAD ICR 10063
; $$FMDIFF^XLFDT ICR 10103
; $$NOW^XLFDT ICR 10103
;
; Local Variables NEWed or KILLed Elsewhere
; LEXAMSO User Selection NEWed/KILLed by LEXRX
; LEXFI File number NEWed/KILLed by LEXRX
; LEXINS Install Flag NEWed/KILLed by Post-Install
; LEXOK Continue flag NEWed/KILLed by LEXRX
;
Q
ALL ; Repair/Re-Index all Lexicon Files
Q:+($G(LEXOK))'>0 Q:$G(LEXAMSO)'="A" N X,Y,ZTQUEUED,ZTREQ,ZTSK
N ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTPRI,LEXI,LEXU,LEXNAM
N LEXC,LEXL,LEXENV,LEXTSK,LEXMSG,LEXSUBJ
S LEXNAM="LEXRXALL" I $D(^XTMP(LEXNAM,0)) D PROG(LEXNAM) Q
K ^TMP("LEXRX",$J) S LEXENV=$$ENV^LEXRXXM Q:+LEXENV'>0
S LEXSUBJ="Lexicon - Repair/Re-Index All Files"
S ZTRTN="ALLT^LEXRXXT2",ZTDESC="Lexicon Index Repair/Re-Index"
S ZTPRI=4,ZTIO="",ZTDTH=$H S:$D(LEXINS) ZTSAVE("LEXINS")=""
S ZTSAVE("DUZ")="",ZTSAVE("LEXAMSO")="",ZTSAVE("LEXSUBJ")=""
S LEXMSG="When the task completes a message will be sent"
S LEXMSG=LEXMSG_" to you reporting the results."
D ^%ZTLOAD K LEXTSK I +($G(ZTSK))>0&('$D(LEXINS)) D
. S LEXTSK(1)="A task has been created to repair the cross-references"
. S LEXTSK(2)="in the major Lexicon files and to re-index the cross-"
. S LEXTSK(3)="references of the supporting Lexicon files. This "
. S LEXTSK(4)="will take several hours, however, users may be on the "
. S LEXTSK(5)="system during this time. (Task #"_+($G(ZTSK))_"). "
. S:$L($G(LEXMSG)) LEXTSK(6)=LEXMSG
I $O(LEXTSK(0))>0&('$D(LEXINS)) D PR^LEXU(.LEXTSK,70)
I '$D(LEXINS) S LEXI=0 F S LEXI=$O(LEXTSK(LEXI)) Q:+LEXI'>0 D
. S LEXC=$$TM^LEXRXXM($G(LEXTSK(LEXI))) W:'$D(LEXINS) !," ",LEXC
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN S LEXI=0
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
MAJ ; Repair/Re-Index all Lookup Related Lexicon Files
Q:+($G(LEXOK))'>0 Q:$G(LEXAMSO)'="M"
N X,Y,ZTQUEUED,ZTREQ,ZTSK,ZTPRI,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI
N LEXU,LEXC,LEXL,LEXENV,LEXTSK,LEXMSG,LEXSUBJ,LEXNAM
S LEXNAM="LEXRXMAJ" I $D(^XTMP(LEXNAM,0)) D PROG(LEXNAM) Q
S LEXSUBJ="Lexicon - Repair Major Files (larger files)"
K ^TMP("LEXRX",$J) S LEXENV=$$ENV^LEXRXXM Q:+LEXENV'>0
S ZTRTN="MAJT^LEXRXXT2",ZTDESC="Lexicon Look-up Index Repair"
S ZTPRI=4,ZTIO="",ZTDTH=$H,ZTSAVE("DUZ")="",ZTSAVE("LEXAMSO")=""
S ZTSAVE("LEXSUBJ")="" S:$D(LEXINS) ZTSAVE("LEXINS")=""
S LEXMSG="When the task completes a message will be sent"
S LEXMSG=LEXMSG_" to you reporting the results."
D ^%ZTLOAD K LEXTSK I +($G(ZTSK))>0&('$D(LEXINS)) D
. S LEXTSK(1)="A task has been created to repair the "
. S LEXTSK(2)="cross-references of the major files in the Lexicon "
. S LEXTSK(3)="(Task #"_+($G(ZTSK))_")."
. S:$L($G(LEXMSG)) LEXTSK(4)=LEXMSG
I $O(LEXTSK(0))>0&('$D(LEXINS)) D PR^LEXU(.LEXTSK,70)
I '$D(LEXINS) S LEXI=0 F S LEXI=$O(LEXTSK(LEXI)) Q:+LEXI'>0 D
. S LEXC=$$TM^LEXRXXM($G(LEXTSK(LEXI))) W:'$D(LEXINS) !," ",LEXC
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN S LEXI=0
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
SUP ; Re-Index all Supporting Lexicon Files (non-Lookup Related)
Q:+($G(LEXOK))'>0 Q:$G(LEXAMSO)'="S" N X,Y,ZTQUEUED,ZTREQ,ZTSK
N ZTDESC,ZTDTH,ZTIO,ZTPRI,ZTRTN,ZTSAVE,LEXI,LEXU,LEXC,LEXL,LEXENV
N LEXTSK,LEXMSG,LEXSUBJ,LEXNAM
S LEXNAM="LEXRXSUP" I $D(^XTMP(LEXNAM,0)) D PROG(LEXNAM) Q
S LEXSUBJ="Lexicon - Re-Index Supporting Files (smaller files)"
K ^TMP("LEXRX",$J) S LEXENV=$$ENV^LEXRXXM Q:+LEXENV'>0
S ZTRTN="SUPT^LEXRXXT2",ZTDESC="Lexicon Look-up Index Repair"
S ZTPRI=4,ZTIO="",ZTDTH=$H,ZTSAVE("DUZ")="",ZTSAVE("LEXAMSO")=""
S ZTSAVE("LEXSUBJ")="" S:$D(LEXINS) ZTSAVE("LEXINS")=""
S LEXMSG="When the task completes a message will be sent"
S LEXMSG=LEXMSG_" to you reporting the results."
D ^%ZTLOAD K LEXTSK I +($G(ZTSK))>0&('$D(LEXINS)) D
. S LEXTSK(1)="A task has been created to re-index the "
. S LEXTSK(2)="cross-references of the supporting files in the "
. S LEXTSK(3)="Lexicon (Task #"_+($G(ZTSK))_")."
. S:$L($G(LEXMSG)) LEXTSK(4)=LEXMSG
I $O(LEXTSK(0))>0&('$D(LEXINS)) D PR^LEXU(.LEXTSK,70)
I '$D(LEXINS) S LEXI=0 F S LEXI=$O(LEXTSK(LEXI)) Q:+LEXI'>0 D
. S LEXC=$$TM^LEXRXXM($G(LEXTSK(LEXI))) W:'$D(LEXINS) !," ",LEXC
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN S LEXI=0
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
ONE ; Repair/Re-Index one file X
Q:+($G(LEXOK))'>0 Q:$G(LEXAMSO)'="O" Q:'$L($G(LEXFI))
S LEXFI=$G(LEXFI) Q:'$D(^LEX(LEXFI))&('$D(^LEXT(LEXFI)))
N Y,ZTQUEUED,ZTREQ,ZTSK,ZTPRI,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
N LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
S LEXNAM="LEXRXONE" I $D(^XTMP(LEXNAM,0)) D PROG(LEXNAM) Q
S LEXENV=$$ENV^LEXRXXM Q:+LEXENV'>0 S LEXTY=""
I "^757^757.001^757.01^757.02^757.1^757.21^757.33^"[("^"_LEXFI_"^") D
. S LEXTY="repair",LEXUTY="Repair"
S:'$L(LEXTY) LEXTY="re-index",LEXUTY="Re-Index"
S LEXFN=$$FN^LEXRXXM(LEXFI)
S LEXSUBJ="Lexicon - "_LEXUTY_" the "_LEXFN_" file #"_LEXFI
S ZTRTN="ONET^LEXRXXT2",ZTIO="",ZTDTH=$H,ZTPRI=4
S ZTDESC="Lexicon Index Repair/Re-Index file "_LEXFI
S:$D(LEXINS) ZTSAVE("LEXINS")=""
S ZTSAVE("DUZ")="",ZTSAVE("LEXFI")="",ZTSAVE("LEXAMSO")=""
S ZTSAVE("LEXSUBJ")="",ZTSAVE("LEXTY")="",ZTSAVE("LEXFN")=""
S LEXMSG="When the task completes a message will be sent"
S LEXMSG=LEXMSG_" to you reporting the results."
D ^%ZTLOAD I +($G(ZTSK))>0&('$D(LEXINS)) D
. S LEXTSK(1)="A task has been created to "_LEXTY_" the "
. S LEXTSK(2)="cross-references in "_$S($L(LEXFN):"the ",1:"Lexicon ")
. S LEXTSK(3)=$S($L(LEXFN):LEXFN,1:"")_" file #"_LEXFI_" "
. S LEXTSK(4)="(Task #"_+($G(ZTSK))_")."
. S:$L($G(LEXMSG)) LEXTSK(5)=LEXMSG
I $O(LEXTSK(0))>0&('$D(LEXINS)) D PR^LEXU(.LEXTSK,70)
I '$D(LEXINS) S LEXI=0 F S LEXI=$O(LEXTSK(LEXI)) Q:+LEXI'>0 D
. S LEXC=$$TM^LEXRXXM($G(LEXTSK(LEXI))) W:'$D(LEXINS) !," ",LEXC
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN S LEXI=0
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
SET ; Set Logic Only
Q:+($G(LEXFI))'>0 S LEXFI=+($G(LEXFI))
Q:'$D(^LEX(LEXFI))&('$D(^LEXT(LEXFI)))
N Y,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTDTH,ZTPRI,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
N LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
N LEXQ,LEXSET S LEXNAM="LEXRXSET" S LEXENV=$$ENV^LEXRXXM Q:+LEXENV'>0
S LEXQ="",ZTRTN="SET^LEXRXXT2",ZTIO="",ZTDTH=$H,LEXSET=""
S ZTDESC="Re-Index file "_LEXFI_", Set Logic Only"
S:$D(LEXINS) ZTSAVE("LEXINS")="" S ZTPRI=4
S ZTSAVE("DUZ")="",ZTSAVE("LEXFI")="",ZTSAVE("LEXQ")=""
S ZTSAVE("LEXSET")="" D ^%ZTLOAD I +($G(ZTSK))>0&('$D(LEXINS)) D
. W !," Re-Index file "_LEXFI_", Set Logic Only (Task #"
. W +($G(ZTSK)),")"
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
FIX ; Fix File and Execure Set Logic Only
Q:+($G(LEXFI))'>0 S LEXFI=+($G(LEXFI))
Q:'$D(^LEX(LEXFI))&('$D(^LEXT(LEXFI)))
Q:"^757.001^757.21^757.33^"'[("^"_LEXFI_"^")
N Y,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTPRI,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
N LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
N LEXQ,LEXSET,LEXFIX S LEXNAM="LEXRXFIX" S LEXENV=$$ENV^LEXRXXM
Q:+LEXENV'>0 S LEXQ="",ZTRTN="FIX^LEXRXXT2",ZTIO="",ZTDTH=$H,ZTPRI=4
S ZTDESC="Re-Index file "_LEXFI_", Set Logic Only"
S (LEXSET,LEXFIX)="" S:$D(LEXINS) ZTSAVE("LEXINS")=""
S ZTSAVE("DUZ")="",ZTSAVE("LEXFI")="",ZTSAVE("LEXQ")=""
S ZTSAVE("LEXNAM")="",ZTSAVE("LEXSET")="",ZTSAVE("LEXFIX")=""
D ^%ZTLOAD I +($G(ZTSK))>0&('$D(LEXINS)) D
. W !," Fix/Re-Index file "_LEXFI_", Set Logic Only (Task #"
. W +($G(ZTSK)),")"
D HOME^%ZIS K ZTDESC,ZTDTH,ZTIO,ZTRTN
W:+($G(ZTSK))>0&('$D(LEXINS)) ! H:+($G(ZTSK))>0&('$D(LEXINS)) 1 K ZTSK
Q
;
; Miscellaneous
PROG(X) ; Progress
N LEXNAME S LEXNAM=$G(X) Q:'$L(LEXNAM) Q:'$D(^XTMP(LEXNAM,0))
N LEXBEG,LEXBEGE,LEXBEGD,LEXUPD,LEXUPDE,LEXUPDD,LEXDES,LEXACT,LEXCUR
N LEXTSK,LEXNOW,LEXND S LEXNOW=$$NOW^XLFDT,LEXND=$G(^XTMP(LEXNAM,0))
S LEXBEG=$P(LEXND,"^",3),LEXDES=$P(LEXND,"^",4)
S LEXTSK=$G(^XTMP(LEXNAM,1)),LEXND=$G(^XTMP(LEXNAM,2))
S LEXUPD=$P(LEXND,"^",1),LEXACT=$P(LEXND,"^",2)
S LEXBEGE=$$ED^LEXRXXM(LEXBEG),LEXUPDE=$$ED^LEXRXXM(LEXUPD)
S LEXBEGD=$$FMDIFF^XLFDT(LEXNOW,LEXBEG,3)
S LEXUPDD=$$FMDIFF^XLFDT(LEXNOW,LEXBEG,3)
S:$E(LEXBEGD,1)=" "&($E(LEXBEGD,3)=":") LEXBEGD=$TR(LEXBEGD," ","0")
S:$E(LEXUPDD,1)=" "&($E(LEXUPDD,3)=":") LEXUPDD=$TR(LEXUPDD," ","0")
W !!," Repair/Re-Index is in progress "
I $L(LEXBEGE),$L(LEXDES) W !,?4,LEXDES,?49,"Started: ",LEXBEGE
I $L(LEXUPDE),$L(LEXACT) W !,?5,LEXACT,?49,"Current: ",LEXUPDE
I $L(LEXBEGD) W !,?49,"Running: ",LEXBEGD
Q
CLR ; Clear
K LEXAMSO,LEXFI,LEXINS,LEXOK
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HLEXRXXT 9232 printed Nov 22, 2024@17:19:39 Page 2
LEXRXXT ;ISL/KER - Repair/Re-Index - Task ;05/23/2017
+1 ;;2.0;LEXICON UTILITY;**81,103**;Sep 23, 1996;Build 2
+2 ;
+3 ; Global Variables
+4 ; ^LEX( SACC 1.3
+5 ; ^LEXT( SACC 1.3
+6 ; ^TMP("LEXRX",$J) SACC 2.3.2.5.1
+7 ; ^XTMP("LEXRX") SACC 2.3.2.5.2
+8 ;
+9 ; External References
+10 ; HOME^%ZIS ICR 10086
+11 ; ^%ZTLOAD ICR 10063
+12 ; $$FMDIFF^XLFDT ICR 10103
+13 ; $$NOW^XLFDT ICR 10103
+14 ;
+15 ; Local Variables NEWed or KILLed Elsewhere
+16 ; LEXAMSO User Selection NEWed/KILLed by LEXRX
+17 ; LEXFI File number NEWed/KILLed by LEXRX
+18 ; LEXINS Install Flag NEWed/KILLed by Post-Install
+19 ; LEXOK Continue flag NEWed/KILLed by LEXRX
+20 ;
+21 QUIT
ALL ; Repair/Re-Index all Lexicon Files
+1 if +($GET(LEXOK))'>0
QUIT
if $GET(LEXAMSO)'="A"
QUIT
NEW X,Y,ZTQUEUED,ZTREQ,ZTSK
+2 NEW ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTPRI,LEXI,LEXU,LEXNAM
+3 NEW LEXC,LEXL,LEXENV,LEXTSK,LEXMSG,LEXSUBJ
+4 SET LEXNAM="LEXRXALL"
IF $DATA(^XTMP(LEXNAM,0))
DO PROG(LEXNAM)
QUIT
+5 KILL ^TMP("LEXRX",$JOB)
SET LEXENV=$$ENV^LEXRXXM
if +LEXENV'>0
QUIT
+6 SET LEXSUBJ="Lexicon - Repair/Re-Index All Files"
+7 SET ZTRTN="ALLT^LEXRXXT2"
SET ZTDESC="Lexicon Index Repair/Re-Index"
+8 SET ZTPRI=4
SET ZTIO=""
SET ZTDTH=$HOROLOG
if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
+9 SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXAMSO")=""
SET ZTSAVE("LEXSUBJ")=""
+10 SET LEXMSG="When the task completes a message will be sent"
+11 SET LEXMSG=LEXMSG_" to you reporting the results."
+12 DO ^%ZTLOAD
KILL LEXTSK
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+13 SET LEXTSK(1)="A task has been created to repair the cross-references"
+14 SET LEXTSK(2)="in the major Lexicon files and to re-index the cross-"
+15 SET LEXTSK(3)="references of the supporting Lexicon files. This "
+16 SET LEXTSK(4)="will take several hours, however, users may be on the "
+17 SET LEXTSK(5)="system during this time. (Task #"_+($GET(ZTSK))_"). "
+18 if $LENGTH($GET(LEXMSG))
SET LEXTSK(6)=LEXMSG
End DoDot:1
+19 IF $ORDER(LEXTSK(0))>0&('$DATA(LEXINS))
DO PR^LEXU(.LEXTSK,70)
+20 IF '$DATA(LEXINS)
SET LEXI=0
FOR
SET LEXI=$ORDER(LEXTSK(LEXI))
if +LEXI'>0
QUIT
Begin DoDot:1
+21 SET LEXC=$$TM^LEXRXXM($GET(LEXTSK(LEXI)))
if '$DATA(LEXINS)
WRITE !," ",LEXC
End DoDot:1
+22 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
SET LEXI=0
+23 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+24 QUIT
MAJ ; Repair/Re-Index all Lookup Related Lexicon Files
+1 if +($GET(LEXOK))'>0
QUIT
if $GET(LEXAMSO)'="M"
QUIT
+2 NEW X,Y,ZTQUEUED,ZTREQ,ZTSK,ZTPRI,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI
+3 NEW LEXU,LEXC,LEXL,LEXENV,LEXTSK,LEXMSG,LEXSUBJ,LEXNAM
+4 SET LEXNAM="LEXRXMAJ"
IF $DATA(^XTMP(LEXNAM,0))
DO PROG(LEXNAM)
QUIT
+5 SET LEXSUBJ="Lexicon - Repair Major Files (larger files)"
+6 KILL ^TMP("LEXRX",$JOB)
SET LEXENV=$$ENV^LEXRXXM
if +LEXENV'>0
QUIT
+7 SET ZTRTN="MAJT^LEXRXXT2"
SET ZTDESC="Lexicon Look-up Index Repair"
+8 SET ZTPRI=4
SET ZTIO=""
SET ZTDTH=$HOROLOG
SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXAMSO")=""
+9 SET ZTSAVE("LEXSUBJ")=""
if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
+10 SET LEXMSG="When the task completes a message will be sent"
+11 SET LEXMSG=LEXMSG_" to you reporting the results."
+12 DO ^%ZTLOAD
KILL LEXTSK
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+13 SET LEXTSK(1)="A task has been created to repair the "
+14 SET LEXTSK(2)="cross-references of the major files in the Lexicon "
+15 SET LEXTSK(3)="(Task #"_+($GET(ZTSK))_")."
+16 if $LENGTH($GET(LEXMSG))
SET LEXTSK(4)=LEXMSG
End DoDot:1
+17 IF $ORDER(LEXTSK(0))>0&('$DATA(LEXINS))
DO PR^LEXU(.LEXTSK,70)
+18 IF '$DATA(LEXINS)
SET LEXI=0
FOR
SET LEXI=$ORDER(LEXTSK(LEXI))
if +LEXI'>0
QUIT
Begin DoDot:1
+19 SET LEXC=$$TM^LEXRXXM($GET(LEXTSK(LEXI)))
if '$DATA(LEXINS)
WRITE !," ",LEXC
End DoDot:1
+20 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
SET LEXI=0
+21 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+22 QUIT
SUP ; Re-Index all Supporting Lexicon Files (non-Lookup Related)
+1 if +($GET(LEXOK))'>0
QUIT
if $GET(LEXAMSO)'="S"
QUIT
NEW X,Y,ZTQUEUED,ZTREQ,ZTSK
+2 NEW ZTDESC,ZTDTH,ZTIO,ZTPRI,ZTRTN,ZTSAVE,LEXI,LEXU,LEXC,LEXL,LEXENV
+3 NEW LEXTSK,LEXMSG,LEXSUBJ,LEXNAM
+4 SET LEXNAM="LEXRXSUP"
IF $DATA(^XTMP(LEXNAM,0))
DO PROG(LEXNAM)
QUIT
+5 SET LEXSUBJ="Lexicon - Re-Index Supporting Files (smaller files)"
+6 KILL ^TMP("LEXRX",$JOB)
SET LEXENV=$$ENV^LEXRXXM
if +LEXENV'>0
QUIT
+7 SET ZTRTN="SUPT^LEXRXXT2"
SET ZTDESC="Lexicon Look-up Index Repair"
+8 SET ZTPRI=4
SET ZTIO=""
SET ZTDTH=$HOROLOG
SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXAMSO")=""
+9 SET ZTSAVE("LEXSUBJ")=""
if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
+10 SET LEXMSG="When the task completes a message will be sent"
+11 SET LEXMSG=LEXMSG_" to you reporting the results."
+12 DO ^%ZTLOAD
KILL LEXTSK
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+13 SET LEXTSK(1)="A task has been created to re-index the "
+14 SET LEXTSK(2)="cross-references of the supporting files in the "
+15 SET LEXTSK(3)="Lexicon (Task #"_+($GET(ZTSK))_")."
+16 if $LENGTH($GET(LEXMSG))
SET LEXTSK(4)=LEXMSG
End DoDot:1
+17 IF $ORDER(LEXTSK(0))>0&('$DATA(LEXINS))
DO PR^LEXU(.LEXTSK,70)
+18 IF '$DATA(LEXINS)
SET LEXI=0
FOR
SET LEXI=$ORDER(LEXTSK(LEXI))
if +LEXI'>0
QUIT
Begin DoDot:1
+19 SET LEXC=$$TM^LEXRXXM($GET(LEXTSK(LEXI)))
if '$DATA(LEXINS)
WRITE !," ",LEXC
End DoDot:1
+20 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
SET LEXI=0
+21 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+22 QUIT
ONE ; Repair/Re-Index one file X
+1 if +($GET(LEXOK))'>0
QUIT
if $GET(LEXAMSO)'="O"
QUIT
if '$LENGTH($GET(LEXFI))
QUIT
+2 SET LEXFI=$GET(LEXFI)
if '$DATA(^LEX(LEXFI))&('$DATA(^LEXT(LEXFI)))
QUIT
+3 NEW Y,ZTQUEUED,ZTREQ,ZTSK,ZTPRI,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
+4 NEW LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
+5 SET LEXNAM="LEXRXONE"
IF $DATA(^XTMP(LEXNAM,0))
DO PROG(LEXNAM)
QUIT
+6 SET LEXENV=$$ENV^LEXRXXM
if +LEXENV'>0
QUIT
SET LEXTY=""
+7 IF "^757^757.001^757.01^757.02^757.1^757.21^757.33^"[("^"_LEXFI_"^")
Begin DoDot:1
+8 SET LEXTY="repair"
SET LEXUTY="Repair"
End DoDot:1
+9 if '$LENGTH(LEXTY)
SET LEXTY="re-index"
SET LEXUTY="Re-Index"
+10 SET LEXFN=$$FN^LEXRXXM(LEXFI)
+11 SET LEXSUBJ="Lexicon - "_LEXUTY_" the "_LEXFN_" file #"_LEXFI
+12 SET ZTRTN="ONET^LEXRXXT2"
SET ZTIO=""
SET ZTDTH=$HOROLOG
SET ZTPRI=4
+13 SET ZTDESC="Lexicon Index Repair/Re-Index file "_LEXFI
+14 if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
+15 SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXFI")=""
SET ZTSAVE("LEXAMSO")=""
+16 SET ZTSAVE("LEXSUBJ")=""
SET ZTSAVE("LEXTY")=""
SET ZTSAVE("LEXFN")=""
+17 SET LEXMSG="When the task completes a message will be sent"
+18 SET LEXMSG=LEXMSG_" to you reporting the results."
+19 DO ^%ZTLOAD
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+20 SET LEXTSK(1)="A task has been created to "_LEXTY_" the "
+21 SET LEXTSK(2)="cross-references in "_$SELECT($LENGTH(LEXFN):"the ",1:"Lexicon ")
+22 SET LEXTSK(3)=$SELECT($LENGTH(LEXFN):LEXFN,1:"")_" file #"_LEXFI_" "
+23 SET LEXTSK(4)="(Task #"_+($GET(ZTSK))_")."
+24 if $LENGTH($GET(LEXMSG))
SET LEXTSK(5)=LEXMSG
End DoDot:1
+25 IF $ORDER(LEXTSK(0))>0&('$DATA(LEXINS))
DO PR^LEXU(.LEXTSK,70)
+26 IF '$DATA(LEXINS)
SET LEXI=0
FOR
SET LEXI=$ORDER(LEXTSK(LEXI))
if +LEXI'>0
QUIT
Begin DoDot:1
+27 SET LEXC=$$TM^LEXRXXM($GET(LEXTSK(LEXI)))
if '$DATA(LEXINS)
WRITE !," ",LEXC
End DoDot:1
+28 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
SET LEXI=0
+29 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+30 QUIT
SET ; Set Logic Only
+1 if +($GET(LEXFI))'>0
QUIT
SET LEXFI=+($GET(LEXFI))
+2 if '$DATA(^LEX(LEXFI))&('$DATA(^LEXT(LEXFI)))
QUIT
+3 NEW Y,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTDTH,ZTPRI,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
+4 NEW LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
+5 NEW LEXQ,LEXSET
SET LEXNAM="LEXRXSET"
SET LEXENV=$$ENV^LEXRXXM
if +LEXENV'>0
QUIT
+6 SET LEXQ=""
SET ZTRTN="SET^LEXRXXT2"
SET ZTIO=""
SET ZTDTH=$HOROLOG
SET LEXSET=""
+7 SET ZTDESC="Re-Index file "_LEXFI_", Set Logic Only"
+8 if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
SET ZTPRI=4
+9 SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXFI")=""
SET ZTSAVE("LEXQ")=""
+10 SET ZTSAVE("LEXSET")=""
DO ^%ZTLOAD
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+11 WRITE !," Re-Index file "_LEXFI_", Set Logic Only (Task #"
+12 WRITE +($GET(ZTSK)),")"
End DoDot:1
+13 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
+14 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+15 QUIT
FIX ; Fix File and Execure Set Logic Only
+1 if +($GET(LEXFI))'>0
QUIT
SET LEXFI=+($GET(LEXFI))
+2 if '$DATA(^LEX(LEXFI))&('$DATA(^LEXT(LEXFI)))
QUIT
+3 if "^757.001^757.21^757.33^"'[("^"_LEXFI_"^")
QUIT
+4 NEW Y,ZTQUEUED,ZTREQ,ZTSK,ZTDESC,ZTPRI,ZTDTH,ZTIO,ZTRTN,ZTSAVE,LEXI,LEXU
+5 NEW LEXC,LEXL,LEXENV,LEXTY,LEXUTY,LEXTSK,LEXMSG,LEXFN,LEXSUBJ,LEXNAM
+6 NEW LEXQ,LEXSET,LEXFIX
SET LEXNAM="LEXRXFIX"
SET LEXENV=$$ENV^LEXRXXM
+7 if +LEXENV'>0
QUIT
SET LEXQ=""
SET ZTRTN="FIX^LEXRXXT2"
SET ZTIO=""
SET ZTDTH=$HOROLOG
SET ZTPRI=4
+8 SET ZTDESC="Re-Index file "_LEXFI_", Set Logic Only"
+9 SET (LEXSET,LEXFIX)=""
if $DATA(LEXINS)
SET ZTSAVE("LEXINS")=""
+10 SET ZTSAVE("DUZ")=""
SET ZTSAVE("LEXFI")=""
SET ZTSAVE("LEXQ")=""
+11 SET ZTSAVE("LEXNAM")=""
SET ZTSAVE("LEXSET")=""
SET ZTSAVE("LEXFIX")=""
+12 DO ^%ZTLOAD
IF +($GET(ZTSK))>0&('$DATA(LEXINS))
Begin DoDot:1
+13 WRITE !," Fix/Re-Index file "_LEXFI_", Set Logic Only (Task #"
+14 WRITE +($GET(ZTSK)),")"
End DoDot:1
+15 DO HOME^%ZIS
KILL ZTDESC,ZTDTH,ZTIO,ZTRTN
+16 if +($GET(ZTSK))>0&('$DATA(LEXINS))
WRITE !
if +($GET(ZTSK))>0&('$DATA(LEXINS))
HANG 1
KILL ZTSK
+17 QUIT
+18 ;
+19 ; Miscellaneous
PROG(X) ; Progress
+1 NEW LEXNAME
SET LEXNAM=$GET(X)
if '$LENGTH(LEXNAM)
QUIT
if '$DATA(^XTMP(LEXNAM,0))
QUIT
+2 NEW LEXBEG,LEXBEGE,LEXBEGD,LEXUPD,LEXUPDE,LEXUPDD,LEXDES,LEXACT,LEXCUR
+3 NEW LEXTSK,LEXNOW,LEXND
SET LEXNOW=$$NOW^XLFDT
SET LEXND=$GET(^XTMP(LEXNAM,0))
+4 SET LEXBEG=$PIECE(LEXND,"^",3)
SET LEXDES=$PIECE(LEXND,"^",4)
+5 SET LEXTSK=$GET(^XTMP(LEXNAM,1))
SET LEXND=$GET(^XTMP(LEXNAM,2))
+6 SET LEXUPD=$PIECE(LEXND,"^",1)
SET LEXACT=$PIECE(LEXND,"^",2)
+7 SET LEXBEGE=$$ED^LEXRXXM(LEXBEG)
SET LEXUPDE=$$ED^LEXRXXM(LEXUPD)
+8 SET LEXBEGD=$$FMDIFF^XLFDT(LEXNOW,LEXBEG,3)
+9 SET LEXUPDD=$$FMDIFF^XLFDT(LEXNOW,LEXBEG,3)
+10 if $EXTRACT(LEXBEGD,1)=" "&($EXTRACT(LEXBEGD,3)="
SET LEXBEGD=$TRANSLATE(LEXBEGD," ","0")
+11 if $EXTRACT(LEXUPDD,1)=" "&($EXTRACT(LEXUPDD,3)="
SET LEXUPDD=$TRANSLATE(LEXUPDD," ","0")
+12 WRITE !!," Repair/Re-Index is in progress "
+13 IF $LENGTH(LEXBEGE)
IF $LENGTH(LEXDES)
WRITE !,?4,LEXDES,?49,"Started: ",LEXBEGE
+14 IF $LENGTH(LEXUPDE)
IF $LENGTH(LEXACT)
WRITE !,?5,LEXACT,?49,"Current: ",LEXUPDE
+15 IF $LENGTH(LEXBEGD)
WRITE !,?49,"Running: ",LEXBEGD
+16 QUIT
CLR ; Clear
+1 KILL LEXAMSO,LEXFI,LEXINS,LEXOK
+2 QUIT