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

ATSERCH4.m

Go to the documentation of this file.
ATSERCH4 ;TUCSON/DG;GETS STORED RESULTS FOR COMPARISON  [ 10/25/91  1:31 PM ]
 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
 ;
 ;
 D ^ATSERCH3 ;GIVES USER CHANCE TO SAVE RESULTS IN A TEMPLATE
 I ATSFLAG D EOJ Q
 ;IN CASE OF A LONG SEARCH WHERE USER MAY BE GONE AND A TIMEOUT
 ;KILLING THE MERGE RESULTS WOULD OCCUR
 D ^ATSERCHD ;CALL TO SEE IF USER WANTS COMPARISON TO BE DONE
 ;VIA TASKMAN
 I ATSTASK!(ATSFLAG) D EOJ Q
ZTM ;ENTRY POINT FOR TASKMAN
 I $D(ZTQEUED) S ZTREQ="@" K ^UTILITY("ATSEARCH",$J)
 W:'ATSTASK !!,"Please wait ..."
 S ATSUB=1 D GET
 S ATSUB=2 D GET
 D MERGE
 I ATSTASK,'$D(ATSETMP) D WRITE^ATSERCHG
 I ATSRCSTR D SEARCH^ATSERCH3
 D CHKMTCH^ATSERCHG
 D EOJ
 D:ATSTASK EOJ^ATSERCH
 Q
 ;
GET ;GETS STORED RESULTS, PLACE IN ^UTILITY
 S (ATSDFN,ATSEDOT,ATSEARCH(ATSUB,"COUNT"),ATSEARCH("MERGE COUNT"))=0
 F L=0:0 S ATSDFN=$O(@(ATSEARCH(ATSUB,"SRCHRESLTREF")_ATSDFN_")")) Q:ATSDFN'=+ATSDFN  D @$S($D(ATSEARCH(ATSUB,"PTEDTOFILE")):"GET3",1:"GET2")
 Q
 ;
GET2 ;CONTINUATION OF FOR LOOP IN GET FOR A DATA FILE THAT IS NOT THE PTED
 ;TO FILE
 S ATSENDPC=ATSEARCH(ATSUB,"DATAGLBLREF")_ATSDFN_","_ATSEARCH(ATSUB,"NODE")_")"
 Q:'$D(@(ATSENDPC))&(ATSENLAG'=2)
 I $D(@(ATSENDPC)) S ATSENDPC=$P(@(ATSENDPC),U,ATSEARCH(ATSUB,"PIECENUM")),ATSEFLY=""
 Q:((ATSENDPC']"")!('$D(ATSEFLY)))&(ATSENLAG'=2)
 S:((ATSENDPC']"")!('$D(ATSEFLY)))&(ATSENLAG=2) ATSENDPC="NULL"
 S ^UTILITY("ATSEARCH",$J,ATSUB,ATSENDPC,ATSDFN)="",ATSEARCH(ATSUB,"COUNT")=ATSEARCH(ATSUB,"COUNT")+1
 S ATSEDOT=ATSEDOT+1 W:'(ATSEDOT#20)&('ATSTASK) "."
 Q
 ;
GET3 ;CONT. OF FOR LOOP IF FILE WITH SEARCH TEMPLATE LINKED TO
 ;IT ALSO THE POINTED TO FILE - FIELD IN FILE POINTED TO FILE MUST
 ;BE THE .01 FIELD OF THE FILE
 S ^UTILITY("ATSEARCH",$J,ATSUB,ATSDFN,ATSDFN)="",ATSEARCH(ATSUB,"COUNT")=ATSEARCH(ATSUB,"COUNT")+1
 S ATSEDOT=ATSEDOT+1 W:'(ATSEDOT#20)&('ATSTASK) "."
 Q
 ;
MERGE ;FIRST TEMPLATE WITH LESSER COUNT, COMPARE TO TEMPLATE TWO
 S (ATSPRIMY,ATSECDY)="^UTILITY(""ATSEARCH"",$J,"
 I (ATSMTCH=1!(ATSMTCH="")),ATSEARCH(1,"COUNT")<ATSEARCH(2,"COUNT") S ATSPRIMY=ATSPRIMY_"1,",ATSECDY=ATSECDY_"2,"
 E  S:ATSMTCH=1!(ATSMTCH="") ATSPRIMY=ATSPRIMY_"2,",ATSECDY=ATSECDY_"1,"
 I ATSMTCH'<2 S ATSPRIMY=$S(ATSMTCH=2:ATSPRIMY_"1,",1:ATSPRIMY_"2,"),ATSECDY=$S(ATSMTCH=2:ATSECDY_"2,",1:ATSECDY_"1,")
 I $D(^UTILITY("ATSEARCH",$J,"MERGED")) D SETTEMP
 K ^UTILITY("ATSEARCH",$J,"MERGED")
 S ATSPTVAL=0 F L=0:0 S ATSPTVAL=$O(@(ATSPRIMY_""""_ATSPTVAL_""""_")")) Q:ATSPTVAL'=+ATSPTVAL&(ATSPTVAL'["NULL")  D MERGE2
 Q
 ;
MERGE2 ;CONT OF FOR LOOP
 I @(ATSNOT_"$D(@(ATSECDY_""""""""_ATSPTVAL_""""""""_"")""))") D @$S(ATSEARCH("FILELINK")=ATSEARCH("PTRFILENUM"):"LINKPTR",1:"LINKSRCH")
 Q
 ;
LINKPTR ;LINK COMMON POINTER VALUES OF FIELDS TO POINTER FILE
 S ATSEARCH("MERGE COUNT")=ATSEARCH("MERGE COUNT")+1
 S ^UTILITY("ATSEARCH",$J,"MERGED",3,ATSPTVAL)=""
 Q
 ;
LINKSRCH ;COMMON POINTER VALUES OF FIELDS
 ;LINK ALL SEARCH RESULTS WITH COMMON POINTER VALUES TO SEARCH FILE
 ;REQUESTED BY USER VIA SEARCH FILE DFN
 I '(ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM")&(ATSNOT="")) S ATSDFN="" F L=0:0 S ATSDFN=$O(^UTILITY("ATSEARCH",$J,ATSX,ATSPTVAL,ATSDFN)) Q:ATSDFN'=+ATSDFN  D CONT
 E  F ATSI=1:1:2 S ATSDFN=0 F ATSL=0:0 S ATSDFN=$O(^UTILITY("ATSEARCH",$J,ATSI,ATSPTVAL,ATSDFN)) Q:ATSDFN'=+ATSDFN  D:'$D(^UTILITY("ATSEARCH",$J,"MERGED",3,ATSDFN)) CONT
 Q
 ;
CONT ;CONT OF LINKSRCH+3
 S ^UTILITY("ATSEARCH",$J,"MERGED",3,ATSDFN)="",ATSEARCH("MERGE COUNT")=ATSEARCH("MERGE COUNT")+1
 Q
 ;
SETTEMP ;SETS NODES WITH RESULTS OF LAST SEARCH COMPARE
 K ^UTILITY("ATSEARCH",$J,"TMP")
 S ATSTMPN=0 F ATSL=0:0 S ATSTMPN=$O(^UTILITY("ATSEARCH",$J,"MERGED",3,ATSTMPN)) Q:ATSTMPN'=+ATSTMPN  S ^UTILITY("ATSEARCH",$J,"TMP",ATSTMPN)=""
 Q
 ;
EOJ ;
 K ATSECDY,ATSPTVAL,ATSDFN,ATSPRIMY,^UTILITY("ATSEARCH",$J,1),^(2),ATSUB,ATSEDOT,ATSENDPC,ATSENUL,ATSEFLY,ATSETMP,ATSTMPN,ATSL,ATSI
 Q
 ;