ATSERCH7 ;TUCSON/DG;MATCH ENTRIES OR USE ENTRIES IN ONLY ONE TEMPLATE [ 10/25/91 1:37 PM ]
;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
;
D MATCH
I ATSFLAG D EOJ Q
D EOJ
Q
;
MATCH ;ASKS USER IF WANTS TO MATCH ENTRIES IN EACH TEMPLATE OR
;WANTS ENTRIES IN ONE TEMPLATE AND NOT IN THE OTHER
I ATSEARCH(1,"SRCHNAM")=ATSEARCH(2,"SRCHNAM") S (ATSMTCH,ATSNOT)="" Q
I ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM") S ATSFR=4
E S ATSFR=3
S X="" F ATSL=0:0 Q:X=+X&(X'<1&(X'>ATSFR)) D:X["?" HELP D MATCH1 W !!,"Your choice (1-",ATSFR,"): 1// " R X:DTIME S:X=""&($T) X=1 S:'$T X="^" I X="^" S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) Q
I X=4 D ^ATSERCHF S ATSFLAG=1
I ATSFLAG Q
E S ATSMTCH=X,ATSNOT=$S(X=1:"",1:"'")
Q
;
MATCH1 ;CONTINUATION OF MATCH, DISPLAYS MENU
W !!,"Choose, by number, one of the following:",!!,1," Select entries in ",ATSEARCH(1,"SRCHNAM")," and also in ",ATSEARCH(2,"SRCHNAM")
W !,2," Select entries in ",ATSEARCH(1,"SRCHNAM")," but not in ",ATSEARCH(2,"SRCHNAM")
W !,3," Select entries in ",ATSEARCH(2,"SRCHNAM")," but not in ",ATSEARCH(1,"SRCHNAM")
I ATSFR=4 W !,4," Select entries in ",ATSEARCH(2,"SRCHNAM")," or in ",ATSEARCH(1,"SRCHNAM")," (Join templates)"
Q
;
NULL ; - EP - ASKS USER IF WANT NULL VALUES
I ATSEARCH(1,"SRCHRESLTREF")=ATSEARCH(2,"SRCHRESLTREF") S ATSENLAG=1 Q ;BOTH TEMPLATES THE SAME, CAN'T LINK TO PTED TO FILE (NULLS), ALREADY LINKED TO "HOST" FILE
I ATSEARCH(1,"FIELD")=.01,ATSEARCH(2,"FIELD")=.01 S ATSENLAG=1 Q
I ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM")!(ATSEARCH("PTRFILENUM")=ATSEARCH(2,"SRCHFILENUM")) S ATSENLAG=1 Q
;IF ONE OF THE SEARCH FILES IS THE POINTED TO FILE, THERE IS NO WAY TO HAVE A NULL ENTRY IN ITS SEARCH TEMPLATE SINCE YOU HAVE TO USE TH E .01 FIELD OF THE PTED TO FILE AS ONE OF THE FIELDS TO COMPARE TO
W !!,"Do you want to include those entries whose pointer field value is null" S %=2 D YN^DICN
I %=2 S ATSENLAG=1 Q
I %=1 S ATSENLAG=2 Q ;INCLUDE NULL POINTER FIELD VALUES
I %=0 S XQH="ATSEARCH-NULL",DIC(0)="X" D EN^XQH W @IOF Q
I %=-1 S ATSENLAG=1,ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1)
Q
;
HELP ;HELP FOR MENU
S XQH="ATSEARCH-ENTRIES",DIC(0)="X" D EN^XQH
W:$D(IOF) @IOF
Q
;
EOJ ;
K X,ATSFR
Q
;
ATSERCH7 ;TUCSON/DG;MATCH ENTRIES OR USE ENTRIES IN ONLY ONE TEMPLATE [ 10/25/91 1:37 PM ]
+1 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
+2 ;
+3 DO MATCH
+4 IF ATSFLAG
DO EOJ
QUIT
+5 DO EOJ
+6 QUIT
+7 ;
MATCH ;ASKS USER IF WANTS TO MATCH ENTRIES IN EACH TEMPLATE OR
+1 ;WANTS ENTRIES IN ONE TEMPLATE AND NOT IN THE OTHER
+2 IF ATSEARCH(1,"SRCHNAM")=ATSEARCH(2,"SRCHNAM")
SET (ATSMTCH,ATSNOT)=""
QUIT
+3 IF ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM")
SET ATSFR=4
+4 IF '$TEST
SET ATSFR=3
+5 SET X=""
FOR ATSL=0:0
IF X=+X&(X'<1&(X'>ATSFR))
QUIT
IF X["?"
DO HELP
DO MATCH1
WRITE !!,"Your choice (1-",ATSFR,"): 1// "
READ X:DTIME
IF X=""&($TEST)
SET X=1
IF '$TEST
SET X="^"
IF X="^"
SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
QUIT
+6 IF X=4
DO ^ATSERCHF
SET ATSFLAG=1
+7 IF ATSFLAG
QUIT
+8 IF '$TEST
SET ATSMTCH=X
SET ATSNOT=$SELECT(X=1:"",1:"'")
+9 QUIT
+10 ;
MATCH1 ;CONTINUATION OF MATCH, DISPLAYS MENU
+1 WRITE !!,"Choose, by number, one of the following:",!!,1," Select entries in ",ATSEARCH(1,"SRCHNAM")," and also in ",ATSEARCH(2,"SRCHNAM")
+2 WRITE !,2," Select entries in ",ATSEARCH(1,"SRCHNAM")," but not in ",ATSEARCH(2,"SRCHNAM")
+3 WRITE !,3," Select entries in ",ATSEARCH(2,"SRCHNAM")," but not in ",ATSEARCH(1,"SRCHNAM")
+4 IF ATSFR=4
WRITE !,4," Select entries in ",ATSEARCH(2,"SRCHNAM")," or in ",ATSEARCH(1,"SRCHNAM")," (Join templates)"
+5 QUIT
+6 ;
NULL ; - EP - ASKS USER IF WANT NULL VALUES
+1 ;BOTH TEMPLATES THE SAME, CAN'T LINK TO PTED TO FILE (NULLS), ALREADY LINKED TO "HOST" FILE
IF ATSEARCH(1,"SRCHRESLTREF")=ATSEARCH(2,"SRCHRESLTREF")
SET ATSENLAG=1
QUIT
+2 IF ATSEARCH(1,"FIELD")=.01
IF ATSEARCH(2,"FIELD")=.01
SET ATSENLAG=1
QUIT
+3 IF ATSEARCH("PTRFILENUM")=ATSEARCH(1,"SRCHFILENUM")!(ATSEARCH("PTRFILENUM")=ATSEARCH(2,"SRCHFILENUM"))
SET ATSENLAG=1
QUIT
+4 ;IF ONE OF THE SEARCH FILES IS THE POINTED TO FILE, THERE IS NO WAY TO HAVE A NULL ENTRY IN ITS SEARCH TEMPLATE SINCE YOU HAVE TO USE TH E .01 FIELD OF THE PTED TO FILE AS ONE OF THE FIELDS TO COMPARE TO
+5 WRITE !!,"Do you want to include those entries whose pointer field value is null"
SET %=2
DO YN^DICN
+6 IF %=2
SET ATSENLAG=1
QUIT
+7 ;INCLUDE NULL POINTER FIELD VALUES
IF %=1
SET ATSENLAG=2
QUIT
+8 IF %=0
SET XQH="ATSEARCH-NULL"
SET DIC(0)="X"
DO EN^XQH
WRITE @IOF
QUIT
+9 IF %=-1
SET ATSENLAG=1
SET ATSFLAG=$SELECT($DATA(^UTILITY("ATSEARCH",$JOB,"MERGED")):2,1:1)
+10 QUIT
+11 ;
HELP ;HELP FOR MENU
+1 SET XQH="ATSEARCH-ENTRIES"
SET DIC(0)="X"
DO EN^XQH
+2 IF $DATA(IOF)
WRITE @IOF
+3 QUIT
+4 ;
EOJ ;
+1 KILL X,ATSFR
+2 QUIT
+3 ;