BPMKALK ;IHS/PHXAO/AEF - KILL "ALK" XREF ON FILE 15 FOR DUPLICATE RECORD MERGE
;;1.0;IHS PATIENT MERGE;;MAR 01, 2010
;IHS/OIT/LJF 10/27/2006 routine originated from Phoenix Area Office
; changed namespace from BZXM to BPM
;
DESC ;----- ROUTINE DESCRIPTION
;;
;;BPMKALK:
;;THIS ROUTINE ENSURES THAT ALL "ALK" CROSSREFERENCES ARE KILLED FOR A
;;MERGED PAIR OF RECORDS CONTAINED IN THE DUPLICATE RECORD FILE #15
;;WHEN THE MERGE IS COMPLETED. THE "AIHSKALK" CROSSREFERENCE CALLS
;;THIS ROUTINE TO KILL THE "ALK" CROSSREFERENCES WHEN THE MERGE STATUS
;;FIELD IS SET TO 2 'MERGED'. FOR SOME REASON THIS CROSSREFERENCE WAS
;;NOT GETTING KILLED WHEN THE ENTRIES WERE MERGED AND THIS INTERFERES
;;WITH THE ^AUPNLK LOOKUP ROUTINE ON THE PATIENT FILE. IF THERE IS AN
;;"ALK" CROSSREFERENCE THEN THE LOOKUP ROUTINE DISPLAYS 'DUPLICATE
;;PATIENT' INFORMATION WHICH IS INAPPROPRIATE IF THE PATIENT BEING
;;SELECTED HAS ALREADY COMPLETED THE MERGE
;;
;;$$END
;
N I,X F I=1:1 S X=$T(DESC+I) Q:X["$$END" W !,$P(X,";;",2)
Q
EN(ST,DA) ;EP
;----- KILL "ALK" CROSSREFERENCES IN FILE 15 FOR ENTRY DA
;
; ST = MERGE STATUS FROM RECORD DA IN FILE 15
; DA = RECORD IEN IN FILE 15
;
N FL,R1,R2,X
;
Q:ST'=2 ;QUIT IF STATUS NOT EQUAL 'MERGED'
;
S X=^VA(15,DA,0)
S FL=$P($P(X,U),";",2)
Q:FL']""
S R1=+$P(X,U)
S R2=+$P(X,U,2)
K ^VA(15,"ALK",""_FL_"",R1,2,R2,DA)
K ^VA(15,"ALK",""_FL_"",R2,2,R1,DA)
Q
BPMKALK ;IHS/PHXAO/AEF - KILL "ALK" XREF ON FILE 15 FOR DUPLICATE RECORD MERGE
+1 ;;1.0;IHS PATIENT MERGE;;MAR 01, 2010
+2 ;IHS/OIT/LJF 10/27/2006 routine originated from Phoenix Area Office
+3 ; changed namespace from BZXM to BPM
+4 ;
DESC ;----- ROUTINE DESCRIPTION
+1 ;;
+2 ;;BPMKALK:
+3 ;;THIS ROUTINE ENSURES THAT ALL "ALK" CROSSREFERENCES ARE KILLED FOR A
+4 ;;MERGED PAIR OF RECORDS CONTAINED IN THE DUPLICATE RECORD FILE #15
+5 ;;WHEN THE MERGE IS COMPLETED. THE "AIHSKALK" CROSSREFERENCE CALLS
+6 ;;THIS ROUTINE TO KILL THE "ALK" CROSSREFERENCES WHEN THE MERGE STATUS
+7 ;;FIELD IS SET TO 2 'MERGED'. FOR SOME REASON THIS CROSSREFERENCE WAS
+8 ;;NOT GETTING KILLED WHEN THE ENTRIES WERE MERGED AND THIS INTERFERES
+9 ;;WITH THE ^AUPNLK LOOKUP ROUTINE ON THE PATIENT FILE. IF THERE IS AN
+10 ;;"ALK" CROSSREFERENCE THEN THE LOOKUP ROUTINE DISPLAYS 'DUPLICATE
+11 ;;PATIENT' INFORMATION WHICH IS INAPPROPRIATE IF THE PATIENT BEING
+12 ;;SELECTED HAS ALREADY COMPLETED THE MERGE
+13 ;;
+14 ;;$$END
+15 ;
+16 NEW I,X
FOR I=1:1
SET X=$TEXT(DESC+I)
IF X["$$END"
QUIT
WRITE !,$PIECE(X,";;",2)
+17 QUIT
EN(ST,DA) ;EP
+1 ;----- KILL "ALK" CROSSREFERENCES IN FILE 15 FOR ENTRY DA
+2 ;
+3 ; ST = MERGE STATUS FROM RECORD DA IN FILE 15
+4 ; DA = RECORD IEN IN FILE 15
+5 ;
+6 NEW FL,R1,R2,X
+7 ;
+8 ;QUIT IF STATUS NOT EQUAL 'MERGED'
IF ST'=2
QUIT
+9 ;
+10 SET X=^VA(15,DA,0)
+11 SET FL=$PIECE($PIECE(X,U),";",2)
+12 IF FL']""
QUIT
+13 SET R1=+$PIECE(X,U)
+14 SET R2=+$PIECE(X,U,2)
+15 KILL ^VA(15,"ALK",""_FL_"",R1,2,R2,DA)
+16 KILL ^VA(15,"ALK",""_FL_"",R2,2,R1,DA)
+17 QUIT