ATSERCH6 ;TUCSON/DG;DISPLAYS THE RESULTS FROM THE COMBINED SEARCH. ALSO ASKS USER FOR AND [ 10/25/91 1:22 PM ]
;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
;PROVIDES INSTRUCTION RE:COMPARE COMBINED RESULTS TO ANOTHER TEMPLATE
;OR TO CREATE A SEARCH TEMPLATE TO BE LINKED TO THE FILE CHOSEN
;
W:$D(IOF) @IOF
D MATCHES
I ATSFLAG D EOJ Q
D DISPLAY
K ATSAGAN
D ^ATSERCH8
W:$D(IOF) @IOF
D EOJ
Q
;
MATCHES ;
I ATSEARCH("MERGE COUNT")'=1 W !!,"There were ",ATSEARCH("MERGE COUNT")," matches associated with the ",$P(^DIC(ATSEARCH("FILELINK"),0),U)," file." I 'ATSEARCH("MERGE COUNT") W *7 H 3
I ATSEARCH("MERGE COUNT")=1 W !!,"There was ",ATSEARCH("MERGE COUNT")," match associated with the ",$P(^DIC(ATSEARCH("FILELINK"),0),U)," file."
I ATSEARCH("MERGE COUNT")=0 S ATSFLAG=$S(ATSLOOP=1:1,1:2) S:ATSFLAG=2 ATSEARCH("FILELINK")=^UTILITY("ATSEARCH",$J,"FILELINK")
;IF FIRST TIME THROUGH AND NO MATCHES, QUIT. IF LATER COMPARE, GIVE USER A CHANCE TO SAVE RESULTS UP UNTIL LAST COMPARE SO AS TO SAVE INTERMEDIATE RESULTS
Q
;
DISPLAY ;DISPLAYS ALL SEARCH PARAMETERS
K % ;IN CASE LEFT FROM DI* ROUTINES
I ATSMTCH=""&(ATSEINRL) W !!,"INTERMEDIATE RESULTS compared to itself via the",!," "_ATSEARCH(1,"FIELD")_" "_ATSEARCH(1,"FIELDNAME")_" field ["_ATSEARCH(1,"SRCHFILENAM")_"]"
I ATSMTCH]"" W !!,"For entries in:",!,$S(ATSMTCH=1:ATSEARCH(1,"SRCHNAM")_" and also in "_ATSEARCH(2,"SRCHNAM"),ATSMTCH=2:ATSEARCH(1,"SRCHNAM")_" but not in "_ATSEARCH(2,"SRCHNAM"),1:ATSEARCH(2,"SRCHNAM")_" but not in "_ATSEARCH(1,"SRCHNAM"))
D @$S(ATSMTCH]"":"DISPLAY2",ATSMTCH=""&ATSEINRL:"^ATSERCHC",1:"DISPLAYX")
F L=0:0 Q:ATSLOOP'>1!($D(ATSAGAN)) D PARAMS
Q
;
DISPLAY2 ;DISPLAY PARAMETERS
I ATSLOOP=1 W !!,"Search specifications are as follows for the two templates:",!
E W !!,"Search specifications are as follows for the ",ATSEARCH(2,"SRCHNAM")," template."
F ATSI=ATSLOOP Q:'$D(ATSEARCH("SEARCHSPECS",ATSI)) S ATSCT=0 F L=0:0 S ATSCT=$O(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)) Q:ATSCT'=+ATSCT D DISPLAY3
Q
;
DISPLAYX ;IF TEMPLATES BEING COMPARED ARE THE SAME (ATSMTCH="")
F ATSI=ATSLOOP Q:'$D(ATSEARCH("SEARCHSPECS",ATSI)) S ATSCT=0 F L=0:0 S ATSCT=$O(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)) Q:ATSCT'=+ATSCT D DISPLAY3
Q
;
DISPLAY3 ;CONTINUATION OF FOR LOOP
S ATSVAR=0 F ATSL=0:0 S ATSVAR=$O(@(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)_ATSVAR_")")) Q:ATSVAR'=+ATSVAR W:ATSLOOP=1&(ATSCT=2)&(ATSVAR=1) ! D LOOPCONT W !,@(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)_ATSVAR_",0"_")")_ATSXVAR D ^ATSERCHC
Q
;
LOOPCONT ;CONTS LOOP IN DISPLAY3 JUST BEFORE WRITE SEARCH PARAMETER
;DETERMINES WHAT FILE THE SEARCH PARAMETER IS LINKED TO
S ATSXVAR=$S(ATSI=1&(ATSCT=1)&(ATSVAR=1):" ["_ATSEARCH(1,"SRCHFILENAM")_"]",ATSI=1&(ATSCT=2)&(ATSVAR=1):" ["_ATSEARCH(2,"SRCHFILENAM")_"]",ATSI>1&(ATSVAR=1):" ["_ATSEARCH(2,"SRCHFILENAM")_"]",1:"")
Q
;
PARAMS ;ASKS USER IF WANTS DISPLAY OF ALL DONE SO FAR
;IF SO, DISPLAYS PREVIOUS COMPARISONS
W !!,"Do you want a display of all you have done so far" S %=2 D YN^DICN
I %=2!(%=-1) S ATSAGAN="" Q
I %=0 S XQH="ATSEARCH-DISPLAY-SEARCH-SPECS" D EN^XQH W:$D(IOF) @IOF Q
W:$D(IOF) @IOF
F ATSI=1:1 Q:'$D(^UTILITY("ATSPECS",$J,ATSI)) W !!,ATSI,". ",$P(^UTILITY("ATSPECS",$J,ATSI,0),U) W:ATSI'=1 !,$P(^(0),U,2) S ATSP=0 F L=0:0 S ATSP=$O(^UTILITY("ATSPECS",$J,ATSI,ATSP)) Q:ATSP'=+ATSP W !," ",^UTILITY("ATSPECS",$J,ATSI,ATSP)
S ATSAGAN=""
Q
;
EOJ ;
K ATSI,ATSAGAN,ATSP,%,ATSCT
Q
;
ATSERCH6 ;TUCSON/DG;DISPLAYS THE RESULTS FROM THE COMBINED SEARCH. ALSO ASKS USER FOR AND [ 10/25/91 1:22 PM ]
+1 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
+2 ;PROVIDES INSTRUCTION RE:COMPARE COMBINED RESULTS TO ANOTHER TEMPLATE
+3 ;OR TO CREATE A SEARCH TEMPLATE TO BE LINKED TO THE FILE CHOSEN
+4 ;
+5 IF $DATA(IOF)
WRITE @IOF
+6 DO MATCHES
+7 IF ATSFLAG
DO EOJ
QUIT
+8 DO DISPLAY
+9 KILL ATSAGAN
+10 DO ^ATSERCH8
+11 IF $DATA(IOF)
WRITE @IOF
+12 DO EOJ
+13 QUIT
+14 ;
MATCHES ;
+1 IF ATSEARCH("MERGE COUNT")'=1
WRITE !!,"There were ",ATSEARCH("MERGE COUNT")," matches associated with the ",$PIECE(^DIC(ATSEARCH("FILELINK"),0),U)," file."
IF 'ATSEARCH("MERGE COUNT")
WRITE *7
HANG 3
+2 IF ATSEARCH("MERGE COUNT")=1
WRITE !!,"There was ",ATSEARCH("MERGE COUNT")," match associated with the ",$PIECE(^DIC(ATSEARCH("FILELINK"),0),U)," file."
+3 IF ATSEARCH("MERGE COUNT")=0
SET ATSFLAG=$SELECT(ATSLOOP=1:1,1:2)
IF ATSFLAG=2
SET ATSEARCH("FILELINK")=^UTILITY("ATSEARCH",$JOB,"FILELINK")
+4 ;IF FIRST TIME THROUGH AND NO MATCHES, QUIT. IF LATER COMPARE, GIVE USER A CHANCE TO SAVE RESULTS UP UNTIL LAST COMPARE SO AS TO SAVE INTERMEDIATE RESULTS
+5 QUIT
+6 ;
DISPLAY ;DISPLAYS ALL SEARCH PARAMETERS
+1 ;IN CASE LEFT FROM DI* ROUTINES
KILL %
+2 IF ATSMTCH=""&(ATSEINRL)
WRITE !!,"INTERMEDIATE RESULTS compared to itself via the",!," "_ATSEARCH(1,"FIELD")_" "_ATSEARCH(1,"FIELDNAME")_" field ["_ATSEARCH(1,"SRCHFILENAM")_"]"
+3 IF ATSMTCH]""
WRITE !!,"For entries in:",!,$SELECT(ATSMTCH=1:ATSEARCH(1,"SRCHNAM")_" and also in "_ATSEARCH(2,"SRCHNAM"),ATSMTCH=2:ATSEARCH(1,"SRCHNAM")_" but not in "_ATSEARCH(2,"SRCHNAM"),1:ATSEARCH(2,"SRCHNAM")_" but not in "_ATSEARCH(1,"SRCHNAM"))
+4 DO @$SELECT(ATSMTCH]"":"DISPLAY2",ATSMTCH=""&ATSEINRL:"^ATSERCHC",1:"DISPLAYX")
+5 FOR L=0:0
IF ATSLOOP'>1!($DATA(ATSAGAN))
QUIT
DO PARAMS
+6 QUIT
+7 ;
DISPLAY2 ;DISPLAY PARAMETERS
+1 IF ATSLOOP=1
WRITE !!,"Search specifications are as follows for the two templates:",!
+2 IF '$TEST
WRITE !!,"Search specifications are as follows for the ",ATSEARCH(2,"SRCHNAM")," template."
+3 FOR ATSI=ATSLOOP
IF '$DATA(ATSEARCH("SEARCHSPECS",ATSI))
QUIT
SET ATSCT=0
FOR L=0:0
SET ATSCT=$ORDER(ATSEARCH("SEARCHSPECS",ATSI,ATSCT))
IF ATSCT'=+ATSCT
QUIT
DO DISPLAY3
+4 QUIT
+5 ;
DISPLAYX ;IF TEMPLATES BEING COMPARED ARE THE SAME (ATSMTCH="")
+1 FOR ATSI=ATSLOOP
IF '$DATA(ATSEARCH("SEARCHSPECS",ATSI))
QUIT
SET ATSCT=0
FOR L=0:0
SET ATSCT=$ORDER(ATSEARCH("SEARCHSPECS",ATSI,ATSCT))
IF ATSCT'=+ATSCT
QUIT
DO DISPLAY3
+2 QUIT
+3 ;
DISPLAY3 ;CONTINUATION OF FOR LOOP
+1 SET ATSVAR=0
FOR ATSL=0:0
SET ATSVAR=$ORDER(@(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)_ATSVAR_")"))
IF ATSVAR'=+ATSVAR
QUIT
IF ATSLOOP=1&(ATSCT=2)&(ATSVAR=1)
WRITE !
DO LOOPCONT
WRITE !,@(ATSEARCH("SEARCHSPECS",ATSI,ATSCT)_ATSVAR_",0"_")")_ATSXVAR
DO ^ATSERCHC
+2 QUIT
+3 ;
LOOPCONT ;CONTS LOOP IN DISPLAY3 JUST BEFORE WRITE SEARCH PARAMETER
+1 ;DETERMINES WHAT FILE THE SEARCH PARAMETER IS LINKED TO
+2 SET ATSXVAR=$SELECT(ATSI=1&(ATSCT=1)&(ATSVAR=1):" ["_ATSEARCH(1,"SRCHFILENAM")_"]",ATSI=1&(ATSCT=2)&(ATSVAR=1):" ["_ATSEARCH(2,"SRCHFILENAM")_"]",ATSI>1&(ATSVAR=1):" ["_ATSEARCH(2,"SRCHFILENAM")_"]",1:"")
+3 QUIT
+4 ;
PARAMS ;ASKS USER IF WANTS DISPLAY OF ALL DONE SO FAR
+1 ;IF SO, DISPLAYS PREVIOUS COMPARISONS
+2 WRITE !!,"Do you want a display of all you have done so far"
SET %=2
DO YN^DICN
+3 IF %=2!(%=-1)
SET ATSAGAN=""
QUIT
+4 IF %=0
SET XQH="ATSEARCH-DISPLAY-SEARCH-SPECS"
DO EN^XQH
IF $DATA(IOF)
WRITE @IOF
QUIT
+5 IF $DATA(IOF)
WRITE @IOF
+6 FOR ATSI=1:1
IF '$DATA(^UTILITY("ATSPECS",$JOB,ATSI))
QUIT
WRITE !!,ATSI,". ",$PIECE(^UTILITY("ATSPECS",$JOB,ATSI,0),U)
IF ATSI'=1
WRITE !,$PIECE(^(0),U,2)
SET ATSP=0
FOR L=0:0
SET ATSP=$ORDER(^UTILITY("ATSPECS",$JOB,ATSI,ATSP))
IF ATSP'=+ATSP
QUIT
WRITE !," ",^UTILITY("ATSPECS",$JOB,ATSI,ATSP)
+7 SET ATSAGAN=""
+8 QUIT
+9 ;
EOJ ;
+1 KILL ATSI,ATSAGAN,ATSP,%,ATSCT
+2 QUIT
+3 ;