source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXNDX3.m@ 1458

Last change on this file since 1458 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 2.6 KB
Line 
1LEXNDX3 ; ISL Set/kill indexes (Part 3) Link ; 09-23-96
2 ;;2.0;LEXICON UTILITY;;Sep 23, 1996
3 ;
4S ; Set indexes for file 757.05
5 Q:('$D(DA))!('$D(X))
6 S DIC="^LEX(757.05,"
7 N LEXREP,LEXBY,LEXOLDX,LEXEXCL,LEXCTR,LEXREC
8 S LEXOLDX=X I X="R" D SREP Q
9 S LEXREP=$P(@(DIC_DA_",0)"),U,1),LEXBY=$P(@(DIC_DA_",0)"),U,2)
10 Q:LEXREP=""!(LEXBY="")
11 I X="N" D UNLINK^LEXNDX4 Q
12 I X="L",$D(^LEX(757.05,DA,1,1,0)) D RELINK^LEXNDX4 Q
13 D EXCL^LEXNDX5 I 'LEXEXCL S LEXOLDX="L" D LINK^LEXNDX4
14 I LEXEXCL,'$D(^LEX(757.01,"AWRD",LEXREP)) D ANYWAY^LEXNDX5 I 'LEXEXCL S LEXOLDX="L" D LINK^LEXNDX4
15 S:LEXEXCL LEXOLDX="R" S X=LEXOLDX,$P(^LEX(757.05,DA,0),U,3)=X
16 K LEXREP,LEXBY,LEXOLDX,LEXEXCL,LEXCTR,LEXREC
17 Q
18SREP ; Set indexes for Replacement Words
19 N LEXEX,LEXRE S LEXEX=$P(^LEX(757.05,DA,0),U,2),LEXRE=$P(^LEX(757.05,DA,0),U,1) I LEXEX=""!(LEXRE="") K LEXRE,LEXEX Q
20 I $D(^LEX(757.01,"B",LEXEX)) D
21 . S LEXEXR=$O(^LEX(757.01,"B",LEXEX,0))
22 . I +LEXEXR>0,$D(^LEX(757.01,LEXEXR)),+(^LEX(757,+(^LEX(757.01,LEXEXR,1)),0))'=LEXEXR D
23 . . S X=LEXEX
24 . . D PTX^LEXTOLKN
25 . . I $D(^TMP("LEXTKN",$J,0)),^TMP("LEXTKN",$J,0)>0 S LEXI="" F LEXJ=1:1:^TMP("LEXTKN",$J,0) D
26 . . . S LEXI=$O(^TMP("LEXTKN",$J,LEXJ,"")) I '$D(^LEX(757.01,"AWRD",LEXI,LEXEXR)) D
27 . . . . N LEXYPE,LEXT S LEXYPE=+($P($G(^LEX(757.01,LEXEXR,1)),U,2)) Q:LEXYPE'>0
28 . . . . S LEXT=+($P($G(^LEX(757.011,LEXYPE,0)),"^",2)) Q:LEXT=0
29 . . . . S ^LEX(757.01,"AWRD",LEXI,LEXEXR,"LINKED")=""
30 . . K LEXI,LEXJ,^TMP("LEXTKN",$J,0),^TMP("LEXTKN",$J)
31 K LEXRE,LEXEX,LEXEXR
32 Q
33K ; Kill indexes for file 757.05
34 Q:$D(DIC)#2=0!('$D(DA))!('$D(X))
35 N LEXREP,LEXBY,LEXOLDX
36 S LEXOLDX=X I X="R" D KREP Q
37 S LEXREP=$P(@(DIC_DA_",0)"),U,1),LEXBY=$P(@(DIC_DA_",0)"),U,2)
38 D UNLINK^LEXNDX4
39 K LEXREP,LEXBY,LEXOLDX
40 Q
41KREP ; Kill indexes for Replacement Words
42 N LEXEX,LEXRE S LEXEX=$P(^LEX(757.05,DA,0),U,2),LEXRE=$P(^LEX(757.05,DA,0),U,1) I LEXEX=""!(LEXRE="") K LEXRE,LEXEX Q
43 I $D(^LEX(757.01,"B",LEXEX)) D
44 . S LEXEXR=$O(^LEX(757.01,"B",LEXEX,0))
45 . I +LEXEXR>0,$D(^LEX(757.01,LEXEXR)),+(^LEX(757,+(^LEX(757.01,LEXEXR,1)),0))'=LEXEXR D
46 . . S X=LEXEX
47 . . D PTX^LEXTOLKN
48 . . I $D(^TMP("LEXTKN",$J,0)),^TMP("LEXTKN",$J,0)>0 S LEXI="" F LEXJ=1:1:^TMP("LEXTKN",$J,0) D
49 . . . S LEXI=$O(^TMP("LEXTKN",$J,LEXJ,"")) I $D(^LEX(757.01,"AWRD",LEXI,LEXEXR)) D
50 . . . . K ^LEX(757.01,"AWRD",LEXI,LEXEXR,"LINKED")
51 . . K LEXI,LEXJ,^TMP("LEXTKN",$J,0),^TMP("LEXTKN",$J)
52 K LEXRE,LEXEX,LEXEXR
53 Q
54RE ; Reindex (Kill/Set) Replacement Words
55 N LEXDA,LEXDIC S LEXDA=0,LEXDIC="^LEX(757.05,"
56 F S LEXDA=$O(^LEX(757.05,LEXDA)) Q:+LEXDA=0 D
57 . S DA=LEXDA,DIC=LEXDIC D KILL^LEXNDX2 S DA=LEXDA,DIC=LEXDIC D SET^LEXNDX2
58 K LEXDA,LEXDIC,DA,DIC
59 Q
Note: See TracBrowser for help on using the repository browser.