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

XMUDNC.m

Go to the documentation of this file.
  1. XMUDNC ;ISC-SF/GMB-Domain Name Change ;04/17/2002 11:48
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; A domain name change happens in two steps, in two patches:
  1. ; 1. The first patch adds the new name as a synonym to the site's
  1. ; DOMAIN file entry at all sites. (Entry SYNONYM)
  1. ; 2. When all sites have added the synonym, the second patch switches
  1. ; the names in the DOMAIN file at all sites. The synonym becomes
  1. ; the domain name, and old domain name becomes the synonym.
  1. ; The domain name is changed in each TCP/IP script, too.
  1. ; The domain name is changed in the Postmaster's basket.
  1. ; The site's name is changed in file 4.3 MAILMAN SITE PARAMETERS.
  1. ; (Entry CHANGE)
  1. SYNONYM ;
  1. D BMES^XPDUTL("Add <new site name> as synonym for <current site name> in DOMAIN file.")
  1. D REINDEX
  1. N XMB,XMI,XMDOM,XMSUBDOM,XMSYN
  1. ;D INIT("S") Q:'$D(^DOPT("XMSYN",$J))
  1. S (XMB,XMI)=""
  1. F S XMB=$O(^DIC(4.2,"B",XMB)) Q:XMB="" D
  1. . F S XMI=$O(^DIC(4.2,"B",XMB,XMI)) Q:XMI="" D
  1. . . N DIC,X,Y
  1. . . S (X,XMDOM)=$P(^DIC(4.2,XMI,0),U,1)
  1. . . S XMSUBDOM=""
  1. . . S DIC="^DOPT(""XMSYN"",$J,"
  1. . . S DIC(0)="XZ"
  1. . . F D ^DIC Q:Y>0!($L(X,".")<4) D
  1. . . . S XMSUBDOM=XMSUBDOM_$P(X,".")_"."
  1. . . . S X=$P(X,".",2,99)
  1. . . Q:Y<0 ; Quit if (sub) domain is not in the table
  1. . . D BMES^XPDUTL("Domain: "_XMDOM)
  1. . . S XMSYN=$P(Y(0),U,2)
  1. . . I XMSYN="" S XMSYN=$P(XMDOM,".",1,$L(XMDOM,".")-2)_".MED.VA.GOV"
  1. . . E S XMSYN=XMSUBDOM_XMSYN
  1. . . D CHKSYN(XMI,XMSYN)
  1. K ^DOPT("XMSYN",$J)
  1. Q
  1. INIT(XMENTRY) ; Load table into global
  1. ; XMENTRY - An entry point in a pre-init (for synonyms) or post-init
  1. ; (for changes).
  1. N DIK,I,X
  1. K ^DOPT("XMSYN",$J)
  1. F I=1:1 S X=$T(@XMENTRY+I) Q:X=" ;;" S ^DOPT("XMSYN",$J,I,0)=$E(X,4,255)
  1. Q:'$D(^DOPT("XMSYN",$J))
  1. S ^DOPT("XMSYN",$J,0)="Domain Synonyms^1N^"
  1. S DIK="^DOPT(""XMSYN"",$J,"
  1. D IXALL^DIK
  1. Q
  1. CHKSYN(XMDIEN,XMSYN) ;
  1. N XMSIEN
  1. D MES^XPDUTL("Lookup Synonym: "_XMSYN)
  1. S XMSIEN=$$FIND1^DIC(4.2,"","MQX",XMSYN,"B^C")
  1. I $D(DIERR) D Q
  1. . N XMI
  1. . D MES^XPDUTL("*** Error on look up!")
  1. . D MES^XPDUTL("*** Usually means more than one occurence.")
  1. . I $D(^DIC(4.2,"B",XMSYN)) D MES^XPDUTL("*** Synonym is also a domain!")
  1. . S XMI=0
  1. . F S XMI=$O(^DIC(4.2,"C",XMSYN,XMI)) Q:'XMI D
  1. . . D MES^XPDUTL("*** Synonym is for domain IEN "_XMI_", name "_$P(^DIC(4.2,XMI,0),U,1))
  1. . D MES^XPDUTL("*** No action taken. Please investigate and fix.")
  1. I XMSIEN=XMDIEN D MES^XPDUTL("Already there.") Q
  1. I XMSIEN D Q
  1. . I $D(^DIC(4.2,"B",XMSYN)) D MES^XPDUTL("*** Synonym is also a domain!")
  1. . E D MES^XPDUTL("*** Synonym is for domain IEN "_XMSIEN_", name "_$P(^DIC(4.2,XMSIEN,0),U,1))
  1. . D MES^XPDUTL("*** No action taken. Please investigate and fix.")
  1. D MES^XPDUTL("Not found. Adding it.")
  1. S XMFDA(4.23,"+1,"_XMDIEN_",",.01)=XMSYN
  1. D UPDATE^DIE("","XMFDA")
  1. I $D(DIERR) D MES^XPDUTL("*** Error adding it!")
  1. Q
  1. CHANGE ;
  1. D BMES^XPDUTL("Change <current site name> to <new site name> in DOMAIN file.")
  1. D REINDEX
  1. N XMB,XMI,XMDOM,XMSUBDOM,XMSYN
  1. ;D INIT("C") Q:'$D(^DOPT("XMSYN",$J))
  1. K ^TMP("XM",$J)
  1. S (XMB,XMI)=""
  1. F S XMB=$O(^DIC(4.2,"B",XMB)) Q:XMB="" D
  1. . F S XMI=$O(^DIC(4.2,"B",XMB,XMI)) Q:XMI="" D
  1. . . N DIC,X,Y,XMSTAT
  1. . . S (X,XMDOM)=$P(^DIC(4.2,XMI,0),U,1)
  1. . . S XMSUBDOM=""
  1. . . S DIC="^DOPT(""XMSYN"",$J,"
  1. . . S DIC(0)="XZ"
  1. . . F D ^DIC Q:Y>0!($L(X,".")<4) D
  1. . . . S XMSUBDOM=XMSUBDOM_$P(X,".")_"."
  1. . . . S X=$P(X,".",2,99)
  1. . . Q:Y<0 ; Quit if (sub) domain is not in the table
  1. . . D BMES^XPDUTL("Domain: "_XMDOM)
  1. . . S XMSYN=$P(Y(0),U,2)
  1. . . I XMSYN="" S XMSYN=$P(XMDOM,".",1,$L(XMDOM,".")-2)_".MED.VA.GOV"
  1. . . E S XMSYN=XMSUBDOM_XMSYN
  1. . . D CHKNAME(XMI,XMDOM,XMSYN,.XMSTAT)
  1. . . S ^TMP("XM",$J,XMDOM)=XMSYN_U_$G(XMSTAT,"ERROR")
  1. I $G(^XMB("NUM"))'=$P(^XMB(1,1,0),U,1) S ^XMB("NUM")=$P(^XMB(1,1,0),U,1)
  1. I ^XMB("NETNAME")'=$P(^DIC(4.2,^XMB("NUM"),0),U,1) D
  1. . S (^XMB("NETNAME"),^XMB("NETNAME"))=$P(^DIC(4.2,^XMB("NUM"),0),U,1)
  1. . D BMES^XPDUTL("The name of this site has been changed to "_^XMB("NETNAME"))
  1. D CSUMM
  1. Q
  1. CHKNAME(XMDIEN,XMDOM,XMSYN,XMSTAT) ;
  1. N XMSIEN
  1. D MES^XPDUTL("Lookup Synonym: "_XMSYN)
  1. S XMSIEN=$$FIND1^DIC(4.2,"","MQX",XMSYN,"B^C")
  1. I $D(DIERR) D Q
  1. . N XMI
  1. . D MES^XPDUTL("*** Error on look up!")
  1. . D MES^XPDUTL("*** Usually means more than one occurence.")
  1. . I $D(^DIC(4.2,"B",XMSYN)) D MES^XPDUTL("*** Synonym is also a domain!")
  1. . S XMI=0
  1. . F S XMI=$O(^DIC(4.2,"C",XMSYN,XMI)) Q:'XMI D
  1. . . D MES^XPDUTL("*** Synonym is for domain IEN "_XMI_", name "_$P(^DIC(4.2,XMI,0),U,1))
  1. . D MES^XPDUTL("*** No action taken. Please investigate and fix.")
  1. I XMSIEN=XMDIEN D Q
  1. . D MES^XPDUTL("Already there. Reversing domain/synonym:")
  1. . D REVERSE(XMDIEN,XMDOM,XMSYN,.XMSTAT)
  1. I XMSIEN D Q
  1. . I $D(^DIC(4.2,"B",XMSYN)) D MES^XPDUTL("*** Synonym is also a domain!")
  1. . E D MES^XPDUTL("*** Synonym is for domain IEN "_XMSIEN_", name "_$P(^DIC(4.2,XMSIEN,0),U,1))
  1. . D MES^XPDUTL("*** No action taken. Please investigate and fix.")
  1. D MES^XPDUTL("Not found. Adding it.")
  1. S XMFDA(4.23,"+1,"_XMDIEN_",",.01)=XMSYN
  1. D UPDATE^DIE("","XMFDA")
  1. I $D(DIERR) D MES^XPDUTL("*** Error adding it!") Q
  1. D MES^XPDUTL("Reversing domain/synonym:")
  1. D REVERSE(XMDIEN,XMDOM,XMSYN,.XMSTAT)
  1. Q
  1. REVERSE(XMDIEN,XMOLDNAM,XMNEWNAM,XMSTAT) ;
  1. I '$D(^DIC(4.2,"C",XMOLDNAM,XMDIEN)) D Q:$D(DIERR)
  1. . D MES^XPDUTL(XMOLDNAM_" is not yet a synonym of itself. Adding it.")
  1. . S XMFDA(4.23,"+1,"_XMDIEN_",",.01)=XMOLDNAM
  1. . D UPDATE^DIE("","XMFDA")
  1. . I $D(DIERR) D MES^XPDUTL("*** Error adding it!")
  1. E D MES^XPDUTL(XMOLDNAM_" is already a synonym of itself.")
  1. D MES^XPDUTL("Change the domain name in the transmission scripts.")
  1. N XMI,XMJ,XMTEXT
  1. S XMI=0
  1. F S XMI=$O(^DIC(4.2,XMDIEN,1,XMI)) Q:'XMI D
  1. . S XMJ=0
  1. . F S XMJ=$O(^DIC(4.2,XMDIEN,1,XMI,1,XMJ)) Q:'XMJ D
  1. . . Q:^DIC(4.2,XMDIEN,1,XMI,1,XMJ,0)'[XMOLDNAM
  1. . . S XMTEXT=^DIC(4.2,XMDIEN,1,XMI,1,XMJ,0)
  1. . . S ^DIC(4.2,XMDIEN,1,XMI,1,XMJ,0)=$P(XMTEXT,XMOLDNAM,1)_XMNEWNAM_$P(XMTEXT,XMOLDNAM,2)
  1. I $D(^XMB(3.7,.5,2,1000+XMDIEN,0)) D
  1. . D MES^XPDUTL("Change the transmission queue name to "_XMNEWNAM_".")
  1. . S XMFDA(3.701,1000+XMDIEN_",.5,",.01)=$E(XMNEWNAM,1,30)
  1. . D FILE^DIE("","XMFDA")
  1. . I $D(DIERR) D MES^XPDUTL("*** Error changing it!")
  1. E D MES^XPDUTL("There is no transmission queue for this domain. That's OK.")
  1. D MES^XPDUTL("Change the domain name to "_XMNEWNAM_".")
  1. S XMFDA(4.2,XMDIEN_",",.01)=XMNEWNAM
  1. D FILE^DIE("","XMFDA")
  1. I $D(DIERR) D MES^XPDUTL("*** Error changing it!") Q
  1. S XMSTAT="DONE"
  1. Q
  1. CSUMM ;
  1. N XMI,XMREC,XMOLD,XMNEW,XMCHK
  1. S XMI=0
  1. F S XMI=$O(^DOPT("XMSYN",$J,XMI)) Q:'XMI S XMREC=^(XMI,0) D
  1. . S XMOLD=$P(XMREC,U,1)
  1. . Q:$D(^TMP("XM",$J,XMOLD))
  1. . S (XMNEW,XMCHK)=$P(XMREC,U,2) I XMNEW="" S XMNEW="xxx.MED.VA.GOV",XMCHK=$P(XMOLD,".",1,$L(XMOLD,".")-2)_".MED.VA.GOV"
  1. . S ^TMP("XM",$J,XMOLD)=XMNEW_U_$S($D(^DIC(4.2,"B",XMCHK)):"OK",1:"???")
  1. D BMES^XPDUTL("Summary for Domain Name Change")
  1. D MES^XPDUTL("Status key:")
  1. D MES^XPDUTL(" OK: Already changed, did not check further.")
  1. D MES^XPDUTL(" DONE: Name changed during this install.")
  1. D MES^XPDUTL(" ERROR: Error noted. See listing above and fix.")
  1. D MES^XPDUTL(" ???: Not in your DOMAIN file. Consider adding it.")
  1. D BMES^XPDUTL($$LJ^XLFSTR("Old Name",34)_" "_$$LJ^XLFSTR("New Name",37)_" Status")
  1. D MES^XPDUTL($$LJ^XLFSTR("",34,"-")_" "_$$LJ^XLFSTR("",37,"-")_" ------")
  1. S XMOLD=""
  1. F S XMOLD=$O(^TMP("XM",$J,XMOLD)) Q:XMOLD="" S XMREC=^(XMOLD) D
  1. . D MES^XPDUTL($$LJ^XLFSTR($E(XMOLD,1,34),35)_$$LJ^XLFSTR($E($P(XMREC,U,1),1,37),38)_$E($P(XMREC,U,2),1,6))
  1. K ^DOPT("XMSYN",$J),^TMP("XM",$J)
  1. Q
  1. REINDEX ;
  1. D MES^XPDUTL("First, let's reindex the B and C xrefs.")
  1. N DIK,DA,XMI
  1. K ^DIC(4.2,"B"),^DIC(4.2,"C")
  1. S DIK="^DIC(4.2,",DIK(1)=".01^B" D ENALL^DIK
  1. S XMI=0
  1. F S XMI=$O(^DIC(4.2,XMI)) Q:'XMI D
  1. . N DIK,DA
  1. . Q:'$O(^DIC(4.2,XMI,2,0))
  1. . S DA(1)=XMI,DIK="^DIC(4.2,"_DA(1)_",2,",DIK(1)=".01^C" D ENALL^DIK
  1. D MES^XPDUTL("Done reindexing. Let's get down to business...")
  1. Q
  1. S ;;current site name^new site name (Add synonyms)
  1. ;;ISC-SF.VA.GOV^FO-OAKLAND.MED.VA.GOV
  1. ;;
  1. C ;;current site name^new site name (Change the names)
  1. ;;ISC-SF.VA.GOV^FO-OAKLAND.MED.VA.GOV
  1. ;;