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

LEXRX.m

Go to the documentation of this file.
  1. LEXRX ;ISL/KER - Re-Index Lexicon ;04/21/2014
  1. ;;2.0;LEXICON UTILITY;**81,80**;Sep 23, 1996;Build 10
  1. ;
  1. ; Global Variables
  1. ; ^LEX( SACC 1.3
  1. ; ^LEXT( SACC 1.3
  1. ; ^TMP("LEXRX") SACC 2.3.2.5.1
  1. ; ^XTMP("LEXRXALL") SACC 2.3.2.5.2
  1. ; ^XTMP("LEXRXFIX") SACC 2.3.2.5.2
  1. ; ^XTMP("LEXRXMAJ") SACC 2.3.2.5.2
  1. ; ^XTMP("LEXRXONE") SACC 2.3.2.5.2
  1. ; ^XTMP("LEXRXSET") SACC 2.3.2.5.2
  1. ; ^XTMP("LEXRXSUP") SACC 2.3.2.5.2
  1. ;
  1. ; External References
  1. ; ^DIC ICR 10006
  1. ; ^DIR ICR 10026
  1. ;
  1. ;
  1. ; Global Variables
  1. ; ^LEX( SACC 1.3
  1. ; ^LEXT( SACC 1.3
  1. ;
  1. ; External References
  1. ; ^DIC ICR 10006
  1. ; ^DIR ICR 10026
  1. ;
  1. ; Callable Entry Points in this Routine
  1. ;
  1. ; EN^LEXRX Task the Repair/Re-Index of one or more Files
  1. ; CHECK^LEXRX Check if a Repair/Re-Index Task is Running
  1. ; MON^LEXRX Monitor Progress of a Running Task
  1. ;
  1. EN ; Main Entry Point
  1. N DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,LEX,LEXAC,LEXAMSO,LEXENV
  1. N LEXFI,LEXFN,LEXMON,LEXOK,LEXRUN,LEXSTA,LEXT,LEXTY,X,Y
  1. K LEXMON S LEXENV=$$ENV^LEXRXXM Q:'LEXENV
  1. W !," Repair/Re-Index Lexicon cross-references"
  1. S LEXRUN=$$CHECK^LEXRXXM2 I +LEXRUN>0 D Q
  1. . W " Try again later",!
  1. N LEXAMSO,LEXFI,LEXOK S LEXOK=0,LEXAMSO=$$AMSO^LEXRXXA
  1. I "^A^M^S^O^"'[("^"_LEXAMSO_"^") D Q
  1. . W !!,?3,"Lexicon index Repair/Re-Index method not selected, aborting"
  1. D:"^A^"[("^"_LEXAMSO_"^") ALL D:"^M^"[("^"_LEXAMSO_"^") MAJ
  1. D:"^S^"[("^"_LEXAMSO_"^") SUP D:"^O^"[("^"_LEXAMSO_"^") ONE
  1. Q
  1. ;
  1. ALL ; All Files
  1. N LEXOK,LEXTY,LEXAMSO K LEXFI S LEXOK=0,LEXAMSO="A"
  1. W !!," ",$$BOLD^LEXRXXM,"Repair/Re-Index the Cross-References for all Lexicon Files",$$NORM^LEXRXXM,!
  1. W !," The cross-references for the larger files will be repaired and the "
  1. W !," smaller files will be re-indexed.",!
  1. W !," Users may be on the system since the cross-references of the larger"
  1. W !," files are not deleted and the re-indexing of the smaller files does"
  1. W !," not involve the Lexicon look-up."
  1. S LEXTY=3 S LEXOK=$$CO^LEXRXXA W ! I +LEXOK>0 K LEXFI D ALL^LEXRXXT
  1. Q
  1. MAJ ; Major Files
  1. N LEXOK,LEXTY,LEXAMSO K LEXFI S LEXOK=0,LEXAMSO="M"
  1. W !!," ",$$BOLD^LEXRXXM,"Repair the Cross-References for the Major Lexicon Files",$$NORM^LEXRXXM,!
  1. W !," The cross-references of the larger files will be repaired by "
  1. W !," verifying the individual subscripts in the cross-reference. Only"
  1. W !," the entries that fail verification will be deleted.",!
  1. W !," Users may be on the system since the cross-references are not"
  1. W !," deleted."
  1. S LEXTY=1 S LEXOK=$$CO^LEXRXXA W ! I +LEXOK>0 K LEXFI D MAJ^LEXRXXT
  1. Q
  1. SUP ; Supporting Files
  1. N LEXOK,LEXTY,LEXAMSO K LEXFI S LEXOK=0,LEXAMSO="S"
  1. W !!," ",$$BOLD^LEXRXXM,"Re-Index the Cross-References for the Supporting Lexicon Files",$$NORM^LEXRXXM,!
  1. W !," The cross-references for the smaller files will be re-indexed.",!
  1. W !," Users may be on the system since the cross-references of the smaller"
  1. W !," files are not involve the Lexicon look-up."
  1. S LEXTY=3 S LEXOK=$$CO^LEXRXXA W ! I +LEXOK>0 K LEXFI D SUP^LEXRXXT
  1. Q
  1. ONE ; One File
  1. N LEXOK,LEXFI,LEXFN,LEXT,LEXTY,LEXAMSO S LEXAMSO="O",LEXFI=$$FI^LEXRXXA I '$L(LEXFI)!(LEXFI["^") W !!," Lexicon file not selected, aborting" Q
  1. I +($$FV^LEXRXXM(($G(LEXFI))))'>0 W !!," Invalid file selected, aborting" Q
  1. S LEXOK=0,LEXFN=$$FN^LEXRXXM(LEXFI) Q:'$L(LEXFN)
  1. S LEXT=LEXFI,LEXT=LEXT_$J(" ",(8-$L(LEXT)))_LEXFN S LEXT=LEXFI_" ("_LEXFN_")" W !
  1. I "^757^757.001^757.01^757.02^757.1^757.21^"[("^"_LEXFI_"^") D
  1. . S LEXTY=1 W !," ",$$BOLD^LEXRXXM,"Repair Cross-References for file ",LEXT,$$NORM^LEXRXXM,! D
  1. . . W !," The cross-references of file "_+LEXFI_" will be repaired by verifying"
  1. . . W !," the individual subscripts in the cross-reference. Only the entries"
  1. . . W !," that fail verification will be deleted. Users may be on the system"
  1. . . W !," since the cross-references are not deleted."
  1. I "^757^757.001^757.01^757.02^757.1^757.21^"'[("^"_LEXFI_"^") D
  1. . S LEXTY=2 W !," ",$$BOLD^LEXRXXM,"Re-Index Cross-References for file ",LEXT,$$NORM^LEXRXXM,! D
  1. . . W !," The cross-references of file "_+LEXFI_" will be re-indexed. Users may"
  1. . . W !," be on the system since this file is not involved in the Lexicon "
  1. . . W !," look-up."
  1. S LEXOK=$$CO^LEXRXXA W ! I +LEXOK>0,$L($G(LEXFI)) D ONE^LEXRXXT
  1. Q
  1. ;
  1. CHECK ; Check if a Repair/Re-Index Task is Running
  1. N LEXSTA K LEXMON S LEXSTA=$$CHECK^LEXRXXM2
  1. I +($G(LEXSTA))'>0 W !!," Lexicon cross-reference repair is not running",!
  1. Q
  1. ;
  1. MON ; Monitor Progress of a Running Task
  1. N LEXMON S LEXMON="" D MON^LEXRXXM2
  1. Q
  1. ;
  1. ; Miscellaneous
  1. FORCE ; Forced Repair/Re-Index
  1. K ^TMP("LEXRX",$J),^XTMP("LEXRXALL"),^XTMP("LEXRXMAJ"),^XTMP("LEXRXSUP"),^XTMP("LEXRXONE"),^XTMP("LEXRXSET"),^XTMP("LEXRXFIX")
  1. D CLR,EN
  1. Q
  1. CLR ; Clear
  1. N LEXID K LEXFIX,LEXSET,LEXTEST
  1. Q