DG53P939 ;JLS - SOURCE OF NOTIFICATION UPDATE ;1/08/17 9:18am
 ;;5.3;Registration;**939**;Aug 13, 1993;Build 14
 ;;Per VHA Directive 2004-038, this routine should not be modified.
 ;
 ; KUM; DG*5.3*939 Post Install routine to update label for 1 source
 ;  Integration Agreements:
 ;        10141 : BMES^XPDUTL
 ;              : MES^XPDUTL
 ;        10018 : UPDATE^DIE
 ;
 Q
 ;
POST ;Update entry in SOURCE OF NOTIFICATION file
 ;
 N ERR,MSG
 S (ERR,MSG)=""
 D UPDREQ
 I ERR'="" D
 . D BMES^XPDUTL("ERROR - "_ERR)
 . ; D BMES^XPDUTL("     *** An Error occurred during updating entry in SOURCE OF NOTIFICATION File ***  ;")
 . D MES^XPDUTL("     Please log a remedy ticket.")
 . Q
 I MSG'="" D
 . D BMES^XPDUTL("    SPOUSE/NOK/OTHER PERSON already exists in SOURCE OF NOTIFICATION file   ")
 . Q
 I (ERR="")&(MSG="") D
 . D BMES^XPDUTL("    SPOUSE/NEXT OF KIN/OTHER PERSON changed to SPOUSE/NOK/OTHER PERSON   ")
 . Q
 Q
 ;
UPDREQ ; Update entry in 47.76
 ;
 N IEN,NAME,NWNAME,FDA
 ; Check if new entry exists, quit if it does
 S NWNAME="SPOUSE/NOK/OTHER PERSON"
 S IEN=$O(^DG(47.76,"B",NWNAME,0))
 I IEN S MSG="SPOUSE/NOK/OTHER PERSON already exists in SOURCE OF NOTIFICATION File" Q
 ;
 ; Check if entry exists, use it if it does
 S NAME="SPOUSE/NEXT OF KIN/OTHER PERSON"
 S IEN=$O(^DG(47.76,"B",NAME,0))
 I 'IEN S ERR="SPOUSE/NEXT OF KIN/OTHER PERSON is not found in SOURCE OF NOTIFICATION File" Q
 ;
 L +^DG(47.76,IEN,0):2
 I '$T S ERR="SOURCE OF NOTIFICATION file (#47.76) is currently locked by another user. Try later"  Q
 ;
 S IEN=IEN_","
 ;
 S FDA(47.76,IEN,.01)="SPOUSE/NOK/OTHER PERSON"
 D UPDATE^DIE("E","FDA","","ERR")
 L -^DG(47.76,IEN,0)
 I $D(ERR("DIERR")) S ERR=$G(ERR("DIERR",1,"TEXT",1)) Q
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDG53P939   1767     printed  Sep 23, 2025@20:16:15                                                                                                                                                                                                    Page 2
DG53P939  ;JLS - SOURCE OF NOTIFICATION UPDATE ;1/08/17 9:18am
 +1       ;;5.3;Registration;**939**;Aug 13, 1993;Build 14
 +2       ;;Per VHA Directive 2004-038, this routine should not be modified.
 +3       ;
 +4       ; KUM; DG*5.3*939 Post Install routine to update label for 1 source
 +5       ;  Integration Agreements:
 +6       ;        10141 : BMES^XPDUTL
 +7       ;              : MES^XPDUTL
 +8       ;        10018 : UPDATE^DIE
 +9       ;
 +10       QUIT 
 +11      ;
POST      ;Update entry in SOURCE OF NOTIFICATION file
 +1       ;
 +2        NEW ERR,MSG
 +3        SET (ERR,MSG)=""
 +4        DO UPDREQ
 +5        IF ERR'=""
               Begin DoDot:1
 +6                DO BMES^XPDUTL("ERROR - "_ERR)
 +7       ; D BMES^XPDUTL("     *** An Error occurred during updating entry in SOURCE OF NOTIFICATION File ***  ;")
 +8                DO MES^XPDUTL("     Please log a remedy ticket.")
 +9                QUIT 
               End DoDot:1
 +10       IF MSG'=""
               Begin DoDot:1
 +11               DO BMES^XPDUTL("    SPOUSE/NOK/OTHER PERSON already exists in SOURCE OF NOTIFICATION file   ")
 +12               QUIT 
               End DoDot:1
 +13       IF (ERR="")&(MSG="")
               Begin DoDot:1
 +14               DO BMES^XPDUTL("    SPOUSE/NEXT OF KIN/OTHER PERSON changed to SPOUSE/NOK/OTHER PERSON   ")
 +15               QUIT 
               End DoDot:1
 +16       QUIT 
 +17      ;
UPDREQ    ; Update entry in 47.76
 +1       ;
 +2        NEW IEN,NAME,NWNAME,FDA
 +3       ; Check if new entry exists, quit if it does
 +4        SET NWNAME="SPOUSE/NOK/OTHER PERSON"
 +5        SET IEN=$ORDER(^DG(47.76,"B",NWNAME,0))
 +6        IF IEN
               SET MSG="SPOUSE/NOK/OTHER PERSON already exists in SOURCE OF NOTIFICATION File"
               QUIT 
 +7       ;
 +8       ; Check if entry exists, use it if it does
 +9        SET NAME="SPOUSE/NEXT OF KIN/OTHER PERSON"
 +10       SET IEN=$ORDER(^DG(47.76,"B",NAME,0))
 +11       IF 'IEN
               SET ERR="SPOUSE/NEXT OF KIN/OTHER PERSON is not found in SOURCE OF NOTIFICATION File"
               QUIT 
 +12      ;
 +13       LOCK +^DG(47.76,IEN,0):2
 +14       IF '$TEST
               SET ERR="SOURCE OF NOTIFICATION file (#47.76) is currently locked by another user. Try later"
               QUIT 
 +15      ;
 +16       SET IEN=IEN_","
 +17      ;
 +18       SET FDA(47.76,IEN,.01)="SPOUSE/NOK/OTHER PERSON"
 +19       DO UPDATE^DIE("E","FDA","","ERR")
 +20       LOCK -^DG(47.76,IEN,0)
 +21       IF $DATA(ERR("DIERR"))
               SET ERR=$GET(ERR("DIERR",1,"TEXT",1))
               QUIT 
 +22       QUIT 
 +23      ;