EC2P119 ;ALB/DAN Update DSS names to uppercase ;1/14/13 11:27
;;2.0;EVENT CAPTURE;**119**;8 May 96;Build 12
POST ;Post install runs from here
N DSSID,NAME,UPNAME,DATA,DUP,UPD,ERR,CNT
D BMES^XPDUTL("Checking DSS UNIT names for lowercase letters")
D CHECK
D BMES^XPDUTL("Sending email to installer and holders of ECMGR key with results of check")
D MAIL
Q
;
CHECK ;Check existing DSS UNIT entries in file 724 for names that have lowercase letters. Convert to uppercase if found.
S DSSID=0 F S DSSID=$O(^ECD(DSSID)) Q:'+DSSID D
.S NAME=$P(^ECD(DSSID,0),U),UPNAME=$$UP^XLFSTR(NAME)
.I NAME=UPNAME Q ;Nothing to change
.I $D(^ECD("B",UPNAME)) S DUP(NAME)=UPNAME Q ;Converting name would cause a duplicate
.S DATA(724,DSSID_",",".01")=UPNAME D FILE^DIE(,"DATA") ;file change in name
.I '$D(^TMP("DIERR",$J)) S UPD(NAME)=UPNAME Q ;Uppercase name stored without error
.S ERR(NAME)="" K ^TMP("DIERR",$J) Q ;Error filing name.
Q
;
MAIL ;Send email with results
N XMSUB,ECTEXT,XMDUZ,XMY,XMZ,XMTEXT,KIEN,DIFROM
S XMDUZ="Event Capture Patch 119 Post-install"
S XMY($G(DUZ,.5))="" ;Set recipient to installer or postmaster
S KIEN=0 F S KIEN=$O(^XUSEC("ECMGR",KIEN)) Q:'+KIEN S XMY(KIEN)="" ;Holders of ECMGR included in email, XUSEC read allowed by DBIA #10076
S XMSUB="Patch EC*2*119 Post install COMPLETED"
S XMTEXT="ECTEXT("
S ECTEXT(1)="The post-install for patch 119, review of DSS UNIT names,"
S ECTEXT(2)="has completed. Below are the results of the review."
S ECTEXT(3)=""
I '$D(DUP)&('$D(UPD))&('$D(ERR)) S ECTEXT(4)="No changes were made and no further action is required." D ^XMD Q
S CNT=4
I $D(UPD) D S ECTEXT(CNT)="",CNT=CNT+1
.S ECTEXT(CNT)="The following entries were updated during this process.",CNT=CNT+1,ECTEXT(CNT)="No further action is required for these entries.",CNT=CNT+1,ECTEXT(CNT)="",CNT=CNT+1
.S NAME="" F S NAME=$O(UPD(NAME)) Q:NAME="" S ECTEXT(CNT)=NAME_" was changed to "_UPD(NAME),CNT=CNT+1
I $D(DUP) D S ECTEXT(CNT)="",CNT=CNT+1
.S ECTEXT(CNT)="The following entries could not be updated because a duplicate entry",CNT=CNT+1,ECTEXT(CNT)="would have been created. Please update entries manually or log a remedy",CNT=CNT+1,ECTEXT(CNT)="ticket for assistance.",CNT=CNT+1
.S ECTEXT(CNT)="",CNT=CNT+1
.S NAME="" F S NAME=$O(DUP(NAME)) Q:NAME="" S ECTEXT(CNT)=NAME_" would have created a duplicate entry to "_DUP(NAME),CNT=CNT+1
I $D(ERR) D
.S ECTEXT(CNT)="The following entries couldn't be updated because an error was encountered.",CNT=CNT+1,ECTEXT(CNT)="Please log a remedy ticket for assistance.",CNT=CNT+1,ECTEXT(CNT)="",CNT=CNT+1
.S NAME="" F S NAME=$O(ERR(NAME)) Q:NAME="" S ECTEXT(CNT)="Couldn't update DSS UNIT "_NAME,CNT=CNT+1
D ^XMD
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEC2P119 2759 printed Apr 09, 2024@21:00:47 Page 2
EC2P119 ;ALB/DAN Update DSS names to uppercase ;1/14/13 11:27
+1 ;;2.0;EVENT CAPTURE;**119**;8 May 96;Build 12
POST ;Post install runs from here
+1 NEW DSSID,NAME,UPNAME,DATA,DUP,UPD,ERR,CNT
+2 DO BMES^XPDUTL("Checking DSS UNIT names for lowercase letters")
+3 DO CHECK
+4 DO BMES^XPDUTL("Sending email to installer and holders of ECMGR key with results of check")
+5 DO MAIL
+6 QUIT
+7 ;
CHECK ;Check existing DSS UNIT entries in file 724 for names that have lowercase letters. Convert to uppercase if found.
+1 SET DSSID=0
FOR
SET DSSID=$ORDER(^ECD(DSSID))
if '+DSSID
QUIT
Begin DoDot:1
+2 SET NAME=$PIECE(^ECD(DSSID,0),U)
SET UPNAME=$$UP^XLFSTR(NAME)
+3 ;Nothing to change
IF NAME=UPNAME
QUIT
+4 ;Converting name would cause a duplicate
IF $DATA(^ECD("B",UPNAME))
SET DUP(NAME)=UPNAME
QUIT
+5 ;file change in name
SET DATA(724,DSSID_",",".01")=UPNAME
DO FILE^DIE(,"DATA")
+6 ;Uppercase name stored without error
IF '$DATA(^TMP("DIERR",$JOB))
SET UPD(NAME)=UPNAME
QUIT
+7 ;Error filing name.
SET ERR(NAME)=""
KILL ^TMP("DIERR",$JOB)
QUIT
End DoDot:1
+8 QUIT
+9 ;
MAIL ;Send email with results
+1 NEW XMSUB,ECTEXT,XMDUZ,XMY,XMZ,XMTEXT,KIEN,DIFROM
+2 SET XMDUZ="Event Capture Patch 119 Post-install"
+3 ;Set recipient to installer or postmaster
SET XMY($GET(DUZ,.5))=""
+4 ;Holders of ECMGR included in email, XUSEC read allowed by DBIA #10076
SET KIEN=0
FOR
SET KIEN=$ORDER(^XUSEC("ECMGR",KIEN))
if '+KIEN
QUIT
SET XMY(KIEN)=""
+5 SET XMSUB="Patch EC*2*119 Post install COMPLETED"
+6 SET XMTEXT="ECTEXT("
+7 SET ECTEXT(1)="The post-install for patch 119, review of DSS UNIT names,"
+8 SET ECTEXT(2)="has completed. Below are the results of the review."
+9 SET ECTEXT(3)=""
+10 IF '$DATA(DUP)&('$DATA(UPD))&('$DATA(ERR))
SET ECTEXT(4)="No changes were made and no further action is required."
DO ^XMD
QUIT
+11 SET CNT=4
+12 IF $DATA(UPD)
Begin DoDot:1
+13 SET ECTEXT(CNT)="The following entries were updated during this process."
SET CNT=CNT+1
SET ECTEXT(CNT)="No further action is required for these entries."
SET CNT=CNT+1
SET ECTEXT(CNT)=""
SET CNT=CNT+1
+14 SET NAME=""
FOR
SET NAME=$ORDER(UPD(NAME))
if NAME=""
QUIT
SET ECTEXT(CNT)=NAME_" was changed to "_UPD(NAME)
SET CNT=CNT+1
End DoDot:1
SET ECTEXT(CNT)=""
SET CNT=CNT+1
+15 IF $DATA(DUP)
Begin DoDot:1
+16 SET ECTEXT(CNT)="The following entries could not be updated because a duplicate entry"
SET CNT=CNT+1
SET ECTEXT(CNT)="would have been created. Please update entries manually or log a remedy"
SET CNT=CNT+1
SET ECTEXT(CNT)="ticket for assistance."
SET CNT=CNT+1
+17 SET ECTEXT(CNT)=""
SET CNT=CNT+1
+18 SET NAME=""
FOR
SET NAME=$ORDER(DUP(NAME))
if NAME=""
QUIT
SET ECTEXT(CNT)=NAME_" would have created a duplicate entry to "_DUP(NAME)
SET CNT=CNT+1
End DoDot:1
SET ECTEXT(CNT)=""
SET CNT=CNT+1
+19 IF $DATA(ERR)
Begin DoDot:1
+20 SET ECTEXT(CNT)="The following entries couldn't be updated because an error was encountered."
SET CNT=CNT+1
SET ECTEXT(CNT)="Please log a remedy ticket for assistance."
SET CNT=CNT+1
SET ECTEXT(CNT)=""
SET CNT=CNT+1
+21 SET NAME=""
FOR
SET NAME=$ORDER(ERR(NAME))
if NAME=""
QUIT
SET ECTEXT(CNT)="Couldn't update DSS UNIT "_NAME
SET CNT=CNT+1
End DoDot:1
+22 DO ^XMD