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

ATSERCH.m

Go to the documentation of this file.
ATSERCH ;TUCSON/DG;COMPARE TWO SORT TEMPLATES WITH SEARCH RESULTS  [ 10/25/91  1:39 PM ]
 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
START ;
 D INIT
 F ATSL=0:0 S ATSLOOP=ATSLOOP+1 D LOOP Q:ATSFLAG  W !
 D EOJ
 Q
 ;
INIT ;
 K ^UTILITY("ATSEARCH",$J),^UTILITY("ATSPECS",$J),^UTILITY("DIQ1",$J)
 S U="^",(ATSLOOP,ATSFLAG,ATSLIST,ATSTASK,ATSEINRL)=0
 I '$D(DTIME) S DTIME=300
 I '$D(DT) S %DT="",X="T" D ^%DT S DT=Y
 Q
 ;
LOOP ;
 I ATSLOOP>1 S ^UTILITY("ATSEARCH",$J,"FILELINK")=ATSEARCH("FILELINK")
 I '$D(^UTILITY("ATSEARCH",$J,"MERGED")) S ATSUB=1,ATSWORD="" D TEMP W !
 I ATSFLAG Q
 I 'ATSEINRL S ATSUB=2,ATSWORD="nother" D TEMP
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 D ^ATSERCH7
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 F L=0:0 D CALL I $D(ATSTOP)!(ATSFLAG) K ATSTOP Q
 ;
 ;PREVIOUS LINE CALLS FLDCHK AND CHKPTRS UNTIL EITHER USER HATS OUT
 ;OR RETURNS OUT (SETS ATSFLAG) OR GETS VALID FIELDS (BOTH POINT
 ;TO THE SAME FILE OR ONE OF THEM IS THE .01 FIELD OF THE FILE
 ;POINTED TO AND THE OTHER FIELD POINTS TO IT - SETS ATSTOP
 ;K ATSTOP SO THAT IF COMPARE ANOTHER TEMPLATE, ATSTOP NOT
 ;SET WHEN ENTER ATSERCH2 (WILL STOP THE LOOP EVEN FIELD DOESN'T POINT)
 ;
 I ATSFLAG Q
 S ATSENLAG=0 F L=0:0 Q:ATSENLAG  D NULL^ATSERCH7
 D @$S(ATSENLAG=2:"^ATSERCHB",1:"^ATSERCH9")
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 D ^ATSERCH6 Q:ATSFLAG=1
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 D ^ATSERCH5
 Q
 ;
TEMP ;ASK FOR TEMPLATE
 K ATSENT
 S DIC("A")="Select a"_ATSWORD_" TEMPLATE: ",DIC="^DIBT(",DIC(0)="QAEZ" D ^DIC K DIC S:((Y>0)&('$D(^DIBT(+Y,1)))) ATSENT="" W:$D(ATSENT) !,"No entries in this template!",*7 G:$D(ATSENT) TEMP D  I ATSFLAG Q
 . I Y<0 S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) Q
 I $D(^DIBT(+Y,"%D")) S ATSPC=0 F L=0:0 S ATSPC=$O(^DIBT(+Y,"%D",ATSPC)) Q:ATSPC'=+ATSPC  W !,^DIBT(+Y,"%D",ATSPC,0)
 E  I $D(^DIBT(+Y,"O")) S ATSPC=0 F L=0:0 S ATSPC=$O(^DIBT(+Y,"O",ATSPC)) Q:ATSPC'=+ATSPC  W !,^DIBT(+Y,"O",ATSPC,0)
 I ($D(^DIBT(+Y,"O"))!($D(^DIBT(+Y,"%D")))),'$D(ATSPEC(+Y)),ATSLOOP=1 S ATSEARCH("SEARCHSPECS",ATSLOOP,ATSUB)=$S($D(^DIBT(+Y,"%D")):"^DIBT("_+Y_",""%D"",",1:"^DIBT("_+Y_",""O"","),ATSPEC(+Y)=""
 E  I ($D(^DIBT(+Y,"O"))!($D(^DIBT(+Y,"%D")))),ATSLOOP'=1 S ATSEARCH("SEARCHSPECS",ATSLOOP,ATSUB)=$S($D(^DIBT(+Y,"%D")):"^DIBT("_+Y_",""%D"",",1:"^DIBT("_+Y_",""O"",")
 S ATSEARCH("SRCHTEMPDFN",ATSUB)=Y
 S ATSEARCH(ATSUB,"SRCHNAM")=$P(Y,U,2)
 S ATSEARCH(ATSUB,"SRCHFILENUM")=$P(^DIBT(+Y,0),U,4)
 S ATSEARCH(ATSUB,"SRCHRESLTREF")="^DIBT("_+Y_",1,"
 S ATSEARCH(ATSUB,"SRCHFILENAM")=$P(^DIC(ATSEARCH(ATSUB,"SRCHFILENUM"),0),U)
 Q
 ;
CALL ;CALL TO FLDCHK AND CHKPTRS (NOW CHKPTRS IS IN ATSERCHE)
 K ATSAME,ATSYVAL ;IN CASE PREVIOUS TEMPLATES LINKED TO SAME FILE
 ;ZT 1
 S ATSUB=1 W ! D ^ATSERCH2
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 S ATSUB=2 D ^ATSERCH2
 I $D(ATSEFRST) K ATSEFRST Q
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 I '$D(ATSEXIT) D ^ATSERCHE
 I ATSFLAG=1 Q
 I ATSFLAG=2 S ATSTORE=1 D CALLSORT^ATSERCH5 Q
 Q
 ;
EOJ ; - EP -
 K ^UTILITY("ATSEARCH",$J),^UTILITY("ATSPECS",$J)
 K ATSFLAG,ATSX,ATSEARCH,ATSI,ATSWORD,ATSASK,ATSL,ATSUB,ATSVAR,ATSPEC,ATSDFN,ATSUM,ATSTORE,ATSMSG,ATSCREEN,ATSMAT,ATSMAT1,ATSLOOP,ATSLIST,ATSRCSTR,ATSETMP
 K ATSAME,ATSPC,ATSYVAL,ATSXVAR,ATSEINRL,ATSMTCH,ATSNOT,ATSENLAG,ATSTASK,ATSTMPNM
 Q
 ;