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

AICDKWL2.m

Go to the documentation of this file.
AICDKWL2 ; IHS/OHPRD/ACC - PART 3 OF LOOKUP CONTROL PROGRAM FOR "AND"ING INVERTED SEARCH ;
 ;;4.0;AICD;;DEC 03, 2014;Build 7
 ; AICDKWCT,AICDREF,AICDREF2 ARE PASSED IN AND SHOULD NOT BE KILLED
 ; THE FOLLOWING ARE PASSED OUT AND SHOULD NOT BE KILLED:
 ;  AICDADFN(),AICDAWRD(),AICDDFN(),AICDNUSE(),AICDNWDS,
 ;  AICDPRTL(),AICDWORD()
 ;
PREPSCH ; PREPARE FOR SEARCH BY BUILDING WORD/DFN TABLES
 S AICDNWDS=0
 G:$O(AICDWT(""))="" PREPSCHX
 S AICDNWS=^DD("KWIC")_"IN^OF^AN^IS^AS^AT^IF^IT^ON^OR^BY^"
 S AICDWD=""
 F AICDQ=0:0 S AICDWD=$O(AICDWT(AICDWD)) Q:AICDWD=""  D WDCHK
 W:AICDASK&AICDNWDS " )",!
PREPSCHX K AICDWT,AICDNWS,AICDWD,AICDQ
 K AICDEXAC,AICDPART,AICDSYN,AICDINCR
 Q
 ;
WDCHK ; DETERMINE IF PARTIAL OR EXACT MATCH
 S AICDWSAV=AICDWD
 S (AICDISNT,AICDFXAC)=0
RECHK I $E(AICDWD)="'" S AICDISNT=1,AICDWD=$E(AICDWD,2,255) G RECHK
 I $E(AICDWD)="~" S AICDFXAC=1,AICDWD=$E(AICDWD,2,255) G RECHK
 I AICDWD?1N.E!(AICDNWS[("^"_AICDWD_"^")) S AICDNUSE=AICDNUSE+1,AICDNUSE(AICDWD)="" G WDCHKX
 S AICDINCR=0,AICDSYN=$D(^AICDKWLC(AICDKWCT,1,"B",AICDWD))
 I 'AICDSYN D CKWD G WDCHKX
 S AICDWDTX=$O(^AICDKWLC(AICDKWCT,1,"B",AICDWD,0))
 S AICDWX=AICDWD,AICDWDSX=0 F AICDQ=0:0 S AICDWDSX=$O(^AICDKWLC(AICDKWCT,1,AICDWDTX,1,AICDWDSX)) Q:AICDWDSX=""  S AICDWD=^AICDKWLC(AICDKWCT,1,AICDWDTX,1,AICDWDSX,0) D CKWD
WDCHKX S AICDWD=AICDWSAV
 K AICDWSAV,AICDWX,AICDISNT,AICDFXAC,AICDWDTX,AICDWDSX
 K AICDI,AICDJ
 Q
CKWD S AICDEXAC=$S($D(@AICDREF):1,1:0)
 S AICDWD2=$O(@AICDREF)
 S AICDPART=('AICDFXAC)&($L(AICDWD)>2)&($S($E(AICDWD2,1,$L(AICDWD))=AICDWD:1,1:0))
 I 'AICDEXAC,'AICDPART S AICDNUSE=AICDNUSE+1,AICDNUSE(AICDWD)="" K AICDWD2 Q
CKNOT I AICDISNT S AICDINCX=AICDINCR,AICDNWDX=AICDNWDS,AICDINCR=1,AICDNWDS=0 D CKWD2 S AICDINCR=AICDINCX,AICDNWDS=AICDNWDX K AICDISNT,AICDINCX,AICDNWDX Q
CKWD2 I AICDASK W:'AICDNWDS "(" W $S(AICDSYN&AICDINCR:"|",1:" ")_$S(AICDFXAC:"~",1:"")_$S(AICDISNT:"'",1:"")_AICDWD
 I 'AICDSYN,AICDEXAC,'AICDPART,'AICDISNT S AICDNWDS=AICDNWDS+1,AICDPRTL(AICDNWDS)=0,AICDWORD(AICDNWDS)=AICDWD,AICDDFN(AICDNWDS)=$O(@AICDREF2) Q
 S:'AICDINCR AICDNWDS=AICDNWDS+1,AICDPRTL(AICDNWDS)=1,AICDWORD(AICDNWDS)=AICDWD
 S AICDWD2=AICDWD
 S AICDN=0 S AICDJ="" F AICDQ=0:0 S AICDJ=$O(AICDAWRD(AICDNWDS,AICDJ)) Q:AICDJ=""  S AICDN=AICDJ
 S AICDN=AICDN+1
 I AICDEXAC S AICDAWRD(AICDNWDS,AICDN)=AICDWD,AICDADFN(AICDNWDS,AICDN)=$O(@AICDREF2),AICDN=AICDN+1
CKWD3 I 'AICDFXAC F AICDN=AICDN:1 S AICDWD=$O(@AICDREF) Q:$E(AICDWD,1,$L(AICDWD2))'=AICDWD2  S AICDAWRD(AICDNWDS,AICDN)=AICDWD,AICDADFN(AICDNWDS,AICDN)=$O(@AICDREF2) W:AICDASK "/",AICDWD
 S AICDWD=AICDWD2
 S AICDN=AICDN-1
 S AICDD=AICDADFN(AICDNWDS,1) F AICDI=1:1:AICDN S:AICDADFN(AICDNWDS,AICDI)<AICDD AICDD=AICDADFN(AICDNWDS,AICDI)
 S AICDDFN(AICDNWDS)=AICDD
 I 'AICDSYN,AICDN=1 S AICDPRTL(AICDNWDS)=0,AICDWORD(AICDNWDS)=AICDAWRD(AICDNWDS,1),AICDDFN(AICDNWDS)=AICDADFN(AICDNWDS,1)
 S AICDINCR=1
 K AICDN,AICDWD2,AICDD
 Q