EC20P95 ;ALB/RPM - PATCH 95 ENV/PRE/POST INSTALL ; 07/29/08
;;2.0; EVENT CAPTURE ;**95**; 8 MAY 96;Build 26
;
ENV ;environment check
S XPDABORT=""
D PROGCHK(.XPDABORT) ;checks programmer variables
;rename option only during install, not during load
I '$G(XPDABORT),$G(XPDENV)=1 D
. I '$$RENOPT("EC NIGHT","EC PCE FEED") S XPDABORT=2
I XPDABORT="" K XPDABORT
Q
;
;
PRE ;pre-install
Q
;
;
POST ;post-install
D POST1 ;build 'APRV' index
Q
;
;
PROGCHK(XPDABORT) ;checks for necessary programmer variables
;
I '$G(DUZ)!($G(DUZ(0))'="@")!('$G(DT))!($G(U)'="^") DO
. D BMES^XPDUTL("******")
. D MES^XPDUTL("Your programming variables are not set up properly.")
. D MES^XPDUTL("Installation aborted.")
. D MES^XPDUTL("******")
. S XPDABORT=2
Q
;
;
RENOPT(ECOLD,ECNEW) ;rename option
;
; Input:
; ECOLD - original option name
; ECNEW - new option name
;
; Output:
; Function value - returns 1 on success; 0 on failure
;
N ECRSLT
S ECRSLT=1
I $G(ECOLD)'="",$G(ECNEW)'="",+$$LKOPT^XPDMENU(ECOLD)>0 D
. D RENAME^XPDMENU(ECOLD,ECNEW)
. I +$$LKOPT^XPDMENU(ECNEW)'>0 D
. . D BMES^XPDUTL("******")
. . D MES^XPDUTL("The installation process failed to rename the")
. . D MES^XPDUTL(ECOLD_" option to "_ECNEW_".")
. . D MES^XPDUTL("Installation aborted.")
. . D MES^XPDUTL("******")
. . S ECRSLT=0
Q ECRSLT
;
POST1 ;Set up TaskMan to build 'APRV' index in the background
N ZTDESC,ZTDTH,ZTIO,ZTQUEUED,ZTREQ,ZTRTN,ZTSAVE,ZTSK
S ZTRTN="BLDIDX^EC20P95"
S ZTDESC="Populate 'APRV' index for EC*2.0*95"
;Queue Task to start in 60 seconds
S ZTDTH=$$SCH^XLFDT("60S",$$NOW^XLFDT)
S ZTIO=""
D ^%ZTLOAD
D BMES^XPDUTL("*****")
D
. I $D(ZTSK)[0 D Q
. .D MES^XPDUTL("TaskMan run to populate 'APRV' index for EC*2.0*95 was not started.")
. .D MES^XPDUTL("Re-run Post Install routine POST1^EC20P95.")
. D MES^XPDUTL("Task "_ZTSK_" started to populate 'APRV' index.")
. I $D(ZTSK("D")) D
. . D MES^XPDUTL("Task will start at "_$$HTE^XLFDT(ZTSK("D")))
D MES^XPDUTL("*****")
Q
;
BLDIDX ;BUILD 'APRV' INDEX
N DA,DIK
N ECMSG ;error/stop messages
N ECSTIME ;start time
N ECCNT ;record counter
N ECQUIT ;task stop flag
;
S ECQUIT=0
S ECCNT=0
S ECMSG=""
S ECSTIME=$$NOW^XLFDT()
S DA(1)=0
F S DA(1)=$O(^ECH(DA(1))) Q:'DA(1)!(ECQUIT) D
. S ECCNT=ECCNT+1
. S DIK="^ECH(DA(1),""PRV"","
. S DIK(1)=".01^APRV"
. D ENALL^DIK
. I ECCNT#1000,$$S^%ZTLOAD D Q
. . S ECMSG=2
. . S ECMSG(1)="Patch EC*2.0*95 'APRV' Re-index Task Stopped by User"
. . S ECMSG(2)="Re-run Post Install routine POST1^EC20P95."
. . S (ZTSTOP,ECQUIT)=1
D NOTIFY(ECSTIME,.ECMSG)
Q
;
NOTIFY(ECSTIME,ECMESS) ;send job msg
;
; Input
; ECSTIME - job start date/time
; ECMESS - free text message array for task stop or errors passed
; by reference
;
; Output
; none
;
N DIFROM,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
N ECSITE,ECETIME,ECTEXT,ECI
S ECSITE=$$SITE^VASITE
S ECETIME=$$NOW^XLFDT
S XMDUZ="'APRV' RE-INDEX"
S XMSUB="Patch EC*2.0*95 ECS FY08 Enhancements"
S XMTEXT="ECTEXT("
S XMY(DUZ)=""
S ECTEXT(1)=""
S ECTEXT(2)=" Facility Name: "_$P(ECSITE,U,2)
S ECTEXT(3)=" Station Number: "_$P(ECSITE,U,3)
S ECTEXT(4)=""
S ECTEXT(5)=" Date/Time job started: "_$$FMTE^XLFDT(ECSTIME)
S ECTEXT(6)=" Date/Time job stopped: "_$$FMTE^XLFDT(ECETIME)
S ECTEXT(7)=""
I $G(ECMESS) D
. F ECI=1:1:ECMESS D
. . S ECTEXT(7+ECI)="*** "_$E($G(ECMESS(ECI)),1,65)
I '$G(ECMESS) D
. S ECTEXT(8)="'APRV' Index Populated Successfully"
D ^XMD
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEC20P95 3647 printed Dec 13, 2024@01:54:40 Page 2
EC20P95 ;ALB/RPM - PATCH 95 ENV/PRE/POST INSTALL ; 07/29/08
+1 ;;2.0; EVENT CAPTURE ;**95**; 8 MAY 96;Build 26
+2 ;
ENV ;environment check
+1 SET XPDABORT=""
+2 ;checks programmer variables
DO PROGCHK(.XPDABORT)
+3 ;rename option only during install, not during load
+4 IF '$GET(XPDABORT)
IF $GET(XPDENV)=1
Begin DoDot:1
+5 IF '$$RENOPT("EC NIGHT","EC PCE FEED")
SET XPDABORT=2
End DoDot:1
+6 IF XPDABORT=""
KILL XPDABORT
+7 QUIT
+8 ;
+9 ;
PRE ;pre-install
+1 QUIT
+2 ;
+3 ;
POST ;post-install
+1 ;build 'APRV' index
DO POST1
+2 QUIT
+3 ;
+4 ;
PROGCHK(XPDABORT) ;checks for necessary programmer variables
+1 ;
+2 IF '$GET(DUZ)!($GET(DUZ(0))'="@")!('$GET(DT))!($GET(U)'="^")
Begin DoDot:1
+3 DO BMES^XPDUTL("******")
+4 DO MES^XPDUTL("Your programming variables are not set up properly.")
+5 DO MES^XPDUTL("Installation aborted.")
+6 DO MES^XPDUTL("******")
+7 SET XPDABORT=2
End DoDot:1
+8 QUIT
+9 ;
+10 ;
RENOPT(ECOLD,ECNEW) ;rename option
+1 ;
+2 ; Input:
+3 ; ECOLD - original option name
+4 ; ECNEW - new option name
+5 ;
+6 ; Output:
+7 ; Function value - returns 1 on success; 0 on failure
+8 ;
+9 NEW ECRSLT
+10 SET ECRSLT=1
+11 IF $GET(ECOLD)'=""
IF $GET(ECNEW)'=""
IF +$$LKOPT^XPDMENU(ECOLD)>0
Begin DoDot:1
+12 DO RENAME^XPDMENU(ECOLD,ECNEW)
+13 IF +$$LKOPT^XPDMENU(ECNEW)'>0
Begin DoDot:2
+14 DO BMES^XPDUTL("******")
+15 DO MES^XPDUTL("The installation process failed to rename the")
+16 DO MES^XPDUTL(ECOLD_" option to "_ECNEW_".")
+17 DO MES^XPDUTL("Installation aborted.")
+18 DO MES^XPDUTL("******")
+19 SET ECRSLT=0
End DoDot:2
End DoDot:1
+20 QUIT ECRSLT
+21 ;
POST1 ;Set up TaskMan to build 'APRV' index in the background
+1 NEW ZTDESC,ZTDTH,ZTIO,ZTQUEUED,ZTREQ,ZTRTN,ZTSAVE,ZTSK
+2 SET ZTRTN="BLDIDX^EC20P95"
+3 SET ZTDESC="Populate 'APRV' index for EC*2.0*95"
+4 ;Queue Task to start in 60 seconds
+5 SET ZTDTH=$$SCH^XLFDT("60S",$$NOW^XLFDT)
+6 SET ZTIO=""
+7 DO ^%ZTLOAD
+8 DO BMES^XPDUTL("*****")
+9 Begin DoDot:1
+10 IF $DATA(ZTSK)[0
Begin DoDot:2
+11 DO MES^XPDUTL("TaskMan run to populate 'APRV' index for EC*2.0*95 was not started.")
+12 DO MES^XPDUTL("Re-run Post Install routine POST1^EC20P95.")
End DoDot:2
QUIT
+13 DO MES^XPDUTL("Task "_ZTSK_" started to populate 'APRV' index.")
+14 IF $DATA(ZTSK("D"))
Begin DoDot:2
+15 DO MES^XPDUTL("Task will start at "_$$HTE^XLFDT(ZTSK("D")))
End DoDot:2
End DoDot:1
+16 DO MES^XPDUTL("*****")
+17 QUIT
+18 ;
BLDIDX ;BUILD 'APRV' INDEX
+1 NEW DA,DIK
+2 ;error/stop messages
NEW ECMSG
+3 ;start time
NEW ECSTIME
+4 ;record counter
NEW ECCNT
+5 ;task stop flag
NEW ECQUIT
+6 ;
+7 SET ECQUIT=0
+8 SET ECCNT=0
+9 SET ECMSG=""
+10 SET ECSTIME=$$NOW^XLFDT()
+11 SET DA(1)=0
+12 FOR
SET DA(1)=$ORDER(^ECH(DA(1)))
if 'DA(1)!(ECQUIT)
QUIT
Begin DoDot:1
+13 SET ECCNT=ECCNT+1
+14 SET DIK="^ECH(DA(1),""PRV"","
+15 SET DIK(1)=".01^APRV"
+16 DO ENALL^DIK
+17 IF ECCNT#1000
IF $$S^%ZTLOAD
Begin DoDot:2
+18 SET ECMSG=2
+19 SET ECMSG(1)="Patch EC*2.0*95 'APRV' Re-index Task Stopped by User"
+20 SET ECMSG(2)="Re-run Post Install routine POST1^EC20P95."
+21 SET (ZTSTOP,ECQUIT)=1
End DoDot:2
QUIT
End DoDot:1
+22 DO NOTIFY(ECSTIME,.ECMSG)
+23 QUIT
+24 ;
NOTIFY(ECSTIME,ECMESS) ;send job msg
+1 ;
+2 ; Input
+3 ; ECSTIME - job start date/time
+4 ; ECMESS - free text message array for task stop or errors passed
+5 ; by reference
+6 ;
+7 ; Output
+8 ; none
+9 ;
+10 NEW DIFROM,XMDUZ,XMSUB,XMTEXT,XMY,XMZ
+11 NEW ECSITE,ECETIME,ECTEXT,ECI
+12 SET ECSITE=$$SITE^VASITE
+13 SET ECETIME=$$NOW^XLFDT
+14 SET XMDUZ="'APRV' RE-INDEX"
+15 SET XMSUB="Patch EC*2.0*95 ECS FY08 Enhancements"
+16 SET XMTEXT="ECTEXT("
+17 SET XMY(DUZ)=""
+18 SET ECTEXT(1)=""
+19 SET ECTEXT(2)=" Facility Name: "_$PIECE(ECSITE,U,2)
+20 SET ECTEXT(3)=" Station Number: "_$PIECE(ECSITE,U,3)
+21 SET ECTEXT(4)=""
+22 SET ECTEXT(5)=" Date/Time job started: "_$$FMTE^XLFDT(ECSTIME)
+23 SET ECTEXT(6)=" Date/Time job stopped: "_$$FMTE^XLFDT(ECETIME)
+24 SET ECTEXT(7)=""
+25 IF $GET(ECMESS)
Begin DoDot:1
+26 FOR ECI=1:1:ECMESS
Begin DoDot:2
+27 SET ECTEXT(7+ECI)="*** "_$EXTRACT($GET(ECMESS(ECI)),1,65)
End DoDot:2
End DoDot:1
+28 IF '$GET(ECMESS)
Begin DoDot:1
+29 SET ECTEXT(8)="'APRV' Index Populated Successfully"
End DoDot:1
+30 DO ^XMD
+31 QUIT