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

XTLKKSCH.m

Go to the documentation of this file.
XTLKKSCH ; IHS/OHPRD/ACC,SFISC/JC - "AND"ING INVERTED LIST SEARCH ;07/22/93  15:45
 ;;7.3;TOOLKIT;;Apr 25, 1995
 ; XTLKNWDS,XTLKREF1,XTLKREF4,XTLKWORD() ARE PASSED IN AND
 ;  SHOULD NOT BE KILLED
 K ^TMP("XTLKHITS",$J) S ^TMP("XTLKHITS",$J)=0
 I $D(XTLKHLIM) S XTLKHLM1=XTLKHLIM+1
 E  S XTLKHLM1=0
 S XTLKCMAX=XTLKDFN(1) F XTLKI=1:1:XTLKNWDS S:XTLKDFN(XTLKI)<XTLKCMAX XTLKCMAX=XTLKDFN(XTLKI)
RESTRT ;
 S XTLKI=0,XTLKEMTY=0
SCLOOP ;
 S XTLKI=XTLKI+1
 G:XTLKI>XTLKNWDS!(XTLKEMTY) ENDCHK
CMP S XTLKLOW=XTLKDFN(XTLKI)<XTLKCMAX,XTLKHIGH=XTLKDFN(XTLKI)>XTLKCMAX
 I XTLKLOW D INCSTK:XTLKPRTL(XTLKI),INCONE:'XTLKPRTL(XTLKI) G:'XTLKEMTY CMP
 I XTLKHIGH S XTLKCMAX=XTLKDFN(XTLKI),XTLKI=0
 G SCLOOP
ENDCHK ;
 G:XTLKEMTY EXIT
 D NOTCHK W:XTLKSAY=1 "." D:'XTLKELIM CHKSCRN
 I 'XTLKELIM S ^TMP("XTLKHITS",$J)=^TMP("XTLKHITS",$J)+1,^TMP("XTLKHITS",$J,^TMP("XTLKHITS",$J))=XTLKCMAX,XTLKHLM1=XTLKHLM1-1 G:XTLKHLM1=0 STOP
 S XTLKCMAX=XTLKCMAX+1
 G RESTRT
STOP W !,"Too many terms meet your criteria; please refine your search.",! K ^TMP("XTLKHITS",$J) S ^TMP("XTLKHITS",$J)=0
EXIT K XTLKEMTY,XTLK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