DGRUGSEE ;ALB/GRR - BACKGROUND CHECKER FOR MASTER FILE CHANGES ;10/19/99  11:00
 ;;5.3;Registration;**190,381,427**;Aug 13, 1993
 Q:'$D(^DGRU(46.11,"AC"))
 I $D(^DGRU(46.11,"AC",2)) D  ;Check for Patient SSN changes
 .N DGFIEN S DGFIEN="" F  S DGFIEN=$O(^DGRU(46.11,"AC",2,DGFIEN)) Q:DGFIEN'>0  D  ;Loop through all SSN changes and call A08 builder
 ..N SSN S SSN=$$GET1^DIQ(46.11,DGFIEN,.01,"I")
 ..N DGOSSN S DGOSSN=$$GET1^DIQ(46.11,DGFIEN,.02,"I")
 ..N DGDA S (DGDA,DFN)=$$GET1^DIQ(46.11,DGFIEN,.04,"I")
 ..N DGRES S DGRES=$$BLDA08^DGRUGBJ(DFN,"","DGZZ","",DGOSSN)
 ..S DIK="^DGRU(46.11,",DA=DGFIEN D ^DIK K DIK
 K ^TMP($J,"DGRUGMFU")
 S DGSENM="DGRU-RAI-MFU-SERVER",DGRSIED=$O(^ORD(101,"B",DGSENM,0))
 D INIT^HLFNC2(DGSENM,.HL)
 S DGRUHLP("PRIORITY")="I"
 I $O(HL(""))']"" D  Q
 .S HLERR(1)=HL
 S DGFILE=0 F  S DGFILE=$O(^DGRU(46.11,"AC",DGFILE)) Q:DGFILE=""  S DGFIEN=0 F  S DGFIEN=$O(^DGRU(46.11,"AC",DGFILE,DGFIEN)) Q:DGFIEN=""  D
 .I DGFILE=36 G DEL ;p-427
 .I DGFILE=42 S DGFNAME="WARD",DGTYPE="LOCATION",DGSEG="LOC"
 .I DGFILE=200 G DEL ;p-427
 .I DGFILE=405.4 S DGFNAME="ROOM-BED",DGTYPE="LOCATION",DGSEG="LOC"
 .I $G(DGSEG)="" G DEL
 .S DGFOUND=0,DGRNEWN=$$GET1^DIQ(46.11,DGFIEN,.01)
 .S DGROLDN=$$GET1^DIQ(46.11,DGFIEN,.02)
 .S DGCIEN=$$GET1^DIQ(46.11,DGFIEN,.04) G:DGCIEN="" DEL
 .I DGFILE=42 S DGWARD=DGCIEN I '$$CHKWARD^DGRUUTL(DGCIEN) G DEL ;p-381 changed
 .I DGFILE=405.4 S DGWARD=0 F  S DGWARD=$O(^DG(405.4,DGCIEN,"W",DGWARD)) Q:DGWARD'>0  I $$CHKWARD^DGRUUTL(DGWARD) S DGFOUND=1 Q
 .I DGFILE=405.4,'DGFOUND G DEL
 .D ENC^DGRUUTL(DGSEG,DGTYPE,DGFILE,DGFNAME,DGROLDN,DGRNEWN,DGRSIED,DGCIEN)
DEL .S DIK="^DGRU(46.11,",DA=DGFIEN D ^DIK K DIK
 Q
