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

ATSERCH2.m

Go to the documentation of this file.
ATSERCH2 ;TUCSON/DG;FLDCHK AND CHKPTRS MODULES FOR MERGE SEARCH UTILITY  [ 10/25/91  1:21 PM ]
 ;;2.5;SEARCH TEMPLATE COMPARISON;;OCT 25, 1991
 ;
 F L=0:0 D QUESTION Q:$D(ATSEXIT)!($D(ATSTOP))!($D(ATSEFRST))
 D:'$D(ATSEXIT)&('$D(ATSEFRST)) SET
 D EOJ
 Q
 ;
QUESTION ;PROMPTS USER FOR FIELD, CHECKS ^DD FOR FIELD AND DATA LOCATION
 K Y ;IN CASE TEMPLATES ARE THE SAME, Y WILL BE SET TO ATSYVAL
 I '$D(ATSAME) D CONTDIC,^DIC K DIC H 1 S:Y<0&(ATSUB=2) ATSEFRST="" Q:Y<0&(ATSUB=2)  I Y<0 S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) S ATSEXIT="" Q
 I ATSUB=1,ATSEARCH(1,"SRCHFILENUM")=ATSEARCH(2,"SRCHFILENUM") S ATSAME="",ATSYVAL=Y
 I '$D(Y) S Y=ATSYVAL
 S ATSEARCH(ATSUB,"FIELD")=+Y
 S ATSEARCH(ATSUB,"FIELDNAME")=$P(Y,U,2)
 S ATSEARCH(ATSUB,"SECONDPCE")=$P(^DD(ATSEARCH(ATSUB,"SRCHFILENUM"),ATSEARCH(ATSUB,"FIELD"),0),U,2)
 I ATSEARCH(ATSUB,"SECONDPCE")["V" W !,*7,"Variable pointers not allowed!" H 2 K ATSAME Q
 I ATSEARCH(ATSUB,"SECONDPCE")'["P",ATSEARCH(ATSUB,"FIELD")'=".01" W *7,!,"This field does not point to a file!" H 2 K ATSAME Q
 S ATSTOP=""
 Q
 ;
CONTDIC ;CONTINUES DIC CALL FOR ASKING USER FOR FIELD
 S DIC("A")="Select a common field from the "_ATSEARCH(ATSUB,"SRCHFILENAM")_" file for comparison: "
 S DIC="^DD("_ATSEARCH(ATSUB,"SRCHFILENUM")_",",DIC(0)="AEMQ"
 S DIC("S")="I +$P(^(0),U,2)'>0,(($P(^(0),U,2)[""P"")!($P(Y,U)=.01))"
 ;
 ;FIRST PART OF SCREEN IF NOT A MULTIPLE FIELD, SECOND PART IF
 ;A FIELD POINTS TO A FILE OR IS THE .01 FIELD
 ;
 Q
 ;
SET I ATSEARCH(ATSUB,"SECONDPCE")["P" F ATSI=1:1:99 Q:$A($E(ATSEARCH(ATSUB,"SECONDPCE"),ATSI))'>57&($A($E(ATSEARCH(ATSUB,"SECONDPCE"),ATSI))'<48)!($E(ATSEARCH(ATSUB,"SECONDPCE"),ATSI)="")
 I ATSEARCH(ATSUB,"SECONDPCE")["P",$E(ATSEARCH(ATSUB,"SECONDPCE"),ATSI)="" W *7,!!,"Dictionary of this file is flawed.  Check status of file!" H 2 S ATSFLAG=$S($D(^UTILITY("ATSEARCH",$J,"MERGED")):2,1:1) Q
 I ATSEARCH(ATSUB,"SECONDPCE")["P" S (ATSEARCH(ATSUB,"PTRFILENUM"),ATSEARCH("PTRFILENUM"))=+($E(ATSEARCH(ATSUB,"SECONDPCE"),ATSI,99))
 E  S ATSEARCH(ATSUB,"PTRFILENUM")=ATSEARCH(ATSUB,"SRCHFILENUM")
 S ATSEARCH(ATSUB,"PIECENUM")=$P($P(^DD(ATSEARCH(ATSUB,"SRCHFILENUM"),ATSEARCH(ATSUB,"FIELD"),0),U,4),";",2),ATSEARCH(ATSUB,"NODE")=$P($P(^DD(ATSEARCH(ATSUB,"SRCHFILENUM"),ATSEARCH(ATSUB,"FIELD"),0),U,4),";")
 S ATSEARCH(ATSUB,"DATAGLBLREF")=^DIC(ATSEARCH(ATSUB,"SRCHFILENUM"),0,"GL") ;SEARCH FILE DATA GLOBAL REFERENCE
 Q
 ;
EOJ ;
 K ATSTOP,ATSEXIT
 Q
 ;