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