GMRC113P ;ABV/MKN - Post-Install routine for GMRC*3*113;8/18/2018 9:35
;;3.0;CONSULT/REQUEST TRACKING;**113**;DEC 27, 1997;Build 50
;
;;ICR Invoked
;;10063, ^%ZTLOAD - $$S
;;10141, ^XPDUTL - BMES, MES
;;10103, ^XLFDT - $$FMADD, $$NOW
;;10070, ^XMD - ENL, ENT1
;
Q
;
POST ;Updates the CSLT CANCELLED TO DISCONTINUED parameter to seed initial values
N DIC,DLAYGO,NA,TSTAMP,X
D BMES^XPDUTL("Updating the parameter CSLT CANCELLED TO DISCONTINUED with initial values:")
D BMES^XPDUTL("Is the overnight cancelled to discontinued job active? = NO")
D MES^XPDUTL("How many days back to start with? = 31")
D MES^XPDUTL("How many days back to end with? = 365")
D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","Is the overnight cancelled to discontinued job active?","NO")
D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to start with?",31)
D PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to end with?",365)
D BMES^XPDUTL("CSLT CANCELLED TO DISCONTINUED parameter has been initialized")
;Kill old option GMRC CANCELLED TO DISCONTINUED, replaced by GMRC CHANGE STATUS X TO DC in test version 7
S DIK="^DIC(19,",DA=$O(^DIC(19,"B","GMRC CANCELLED TO DISCONTINUED","")) D:DA ^DIK
;Add to file #19.2 (OPTION SCHEDULING)
D BMES^XPDUTL("Set up schedule for GMRC CHANGE STATUS X TO DC")
I $$FIND1^DIC(19.2,,"B","GMRC CHANGE STATUS X TO DC","B") D MES^XPDUTL("Already scheduled")
E D
.S (DLAYGO,DIC)=19.2,DIC(0)="L"
.S X="GMRC CHANGE STATUS X TO DC"
.S TSTAMP=$$FMADD^XLFDT($$NOW^XLFDT(),1),$P(TSTAMP,".",2)="23"
.S DIC("DR")="2////"_TSTAMP_";6////D@11:00PM" D ^DIC
;
D QUEUE
Q
;
QUEUE ;Create entries in new index ASTATUS, task entry point
N ZTRTN,ZTDESC,ZTREQ,ZTIO,ZTDTH,ZTSK
D BMES^XPDUTL("Calling TaskMan to create background job to create entries in new index ASTATUS")
S ZTRTN="EN^GMRC113P",ZTDESC="Create entries in file #123 for new index ASTATUS",ZTIO="",ZTDTH=$H
D ^%ZTLOAD I '$G(ZTSK) D BMES^XPDUTL("Unable to create TaskMan job - run EN^GMRC113P after install finishes") Q
D BMES^XPDUTL("Post-install queued as task #"_$G(ZTSK))
Q
;
EN ;Create Consult record entries for new ASTATUS index
N DA,DIK,HANGRECS,HANGSECS,IEN123,IEN12340,NUMRECS,X,ZTSTOP
S HANGRECS=10000,HANGSECS=10 ;Hang every 10,000 records for 10 seconds
S (NUMRECS,ZTSTOP)=0,IEN123=$G(^GMR(123,"ASTATUS",0),"@")
F S IEN123=$O(^GMR(123,IEN123),-1) Q:'IEN123!(ZTSTOP) D
.S ^GMR(123,"ASTATUS",0)=IEN123 ;This is to allow re-entrance of this function after being manually shut down
.I $$S^%ZTLOAD D Q
..S ZTSTOP=1,X=$$S^%ZTLOAD("GMRC*3.0*113 post-install received a shutdown request")
..D MSG("GMRC*3.0*113 post-install received a shutdown request")
.S IEN12340=$O(^GMR(123,IEN123,40,0)) D:IEN12340?1.N
..K DA S DA=IEN12340,DA(1)=IEN123
..S DIK="^GMR(123,"_DA(1)_",40,",DIK(1)=".01^ASTATUS" D ENALL^DIK
..S NUMRECS=NUMRECS+1
.H:'(NUMRECS#HANGRECS) HANGSECS
K:'ZTSTOP ^GMR(123,"ASTATUS",0)
S ZTREQ="@"
I 'ZTSTOP D MSG("GMRC*3.0*113 - the background job has finished setting up the new index ""ASTATUS""")
E D
.S X="GMRC*3.0*113 - the background job was stopped whilst adding records to the new index ""ASTATUS"". "
.S X=X_"If you re-install the patch, it will continue where it left off."
.D MSG(X)
Q
;
MSG(SUB) ;create and send message
N XMDUZ,XMSUB,XMZ,XMTEXT,XMY
N IEN,A,B,C,LNCNT S (IEN,A,B,C)=0,LNCNT=1
S XMY(DUZ)=""
S XMDUZ=DUZ
S XMSUB=SUB
D XMZ^XMA2 ; call Create Message Module
S XMTEXT="XMTEXT"
S XMTEXT(1)="GMRC*3.0*113 post-install background job received a shutdown request"
S XMTEXT(2)="- update of ""ASTATUS"" index aborted. if the patch is re-installed, the"
S XMTEXT(3)="update to the index will continue at the Consult IEN where it left off"
S XMTEXT(4)="in this run."
D ENL^XMD
D ENT1^XMD
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMRC113P 3950 printed Dec 13, 2024@01:44:40 Page 2
GMRC113P ;ABV/MKN - Post-Install routine for GMRC*3*113;8/18/2018 9:35
+1 ;;3.0;CONSULT/REQUEST TRACKING;**113**;DEC 27, 1997;Build 50
+2 ;
+3 ;;ICR Invoked
+4 ;;10063, ^%ZTLOAD - $$S
+5 ;;10141, ^XPDUTL - BMES, MES
+6 ;;10103, ^XLFDT - $$FMADD, $$NOW
+7 ;;10070, ^XMD - ENL, ENT1
+8 ;
+9 QUIT
+10 ;
POST ;Updates the CSLT CANCELLED TO DISCONTINUED parameter to seed initial values
+1 NEW DIC,DLAYGO,NA,TSTAMP,X
+2 DO BMES^XPDUTL("Updating the parameter CSLT CANCELLED TO DISCONTINUED with initial values:")
+3 DO BMES^XPDUTL("Is the overnight cancelled to discontinued job active? = NO")
+4 DO MES^XPDUTL("How many days back to start with? = 31")
+5 DO MES^XPDUTL("How many days back to end with? = 365")
+6 DO PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","Is the overnight cancelled to discontinued job active?","NO")
+7 DO PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to start with?",31)
+8 DO PUT^XPAR("PKG.CONSULT/REQUEST TRACKING","CSLT CANCELLED TO DISCONTINUED","How many days back to end with?",365)
+9 DO BMES^XPDUTL("CSLT CANCELLED TO DISCONTINUED parameter has been initialized")
+10 ;Kill old option GMRC CANCELLED TO DISCONTINUED, replaced by GMRC CHANGE STATUS X TO DC in test version 7
+11 SET DIK="^DIC(19,"
SET DA=$ORDER(^DIC(19,"B","GMRC CANCELLED TO DISCONTINUED",""))
if DA
DO ^DIK
+12 ;Add to file #19.2 (OPTION SCHEDULING)
+13 DO BMES^XPDUTL("Set up schedule for GMRC CHANGE STATUS X TO DC")
+14 IF $$FIND1^DIC(19.2,,"B","GMRC CHANGE STATUS X TO DC","B")
DO MES^XPDUTL("Already scheduled")
+15 IF '$TEST
Begin DoDot:1
+16 SET (DLAYGO,DIC)=19.2
SET DIC(0)="L"
+17 SET X="GMRC CHANGE STATUS X TO DC"
+18 SET TSTAMP=$$FMADD^XLFDT($$NOW^XLFDT(),1)
SET $PIECE(TSTAMP,".",2)="23"
+19 SET DIC("DR")="2////"_TSTAMP_";6////D@11:00PM"
DO ^DIC
End DoDot:1
+20 ;
+21 DO QUEUE
+22 QUIT
+23 ;
QUEUE ;Create entries in new index ASTATUS, task entry point
+1 NEW ZTRTN,ZTDESC,ZTREQ,ZTIO,ZTDTH,ZTSK
+2 DO BMES^XPDUTL("Calling TaskMan to create background job to create entries in new index ASTATUS")
+3 SET ZTRTN="EN^GMRC113P"
SET ZTDESC="Create entries in file #123 for new index ASTATUS"
SET ZTIO=""
SET ZTDTH=$HOROLOG
+4 DO ^%ZTLOAD
IF '$GET(ZTSK)
DO BMES^XPDUTL("Unable to create TaskMan job - run EN^GMRC113P after install finishes")
QUIT
+5 DO BMES^XPDUTL("Post-install queued as task #"_$GET(ZTSK))
+6 QUIT
+7 ;
EN ;Create Consult record entries for new ASTATUS index
+1 NEW DA,DIK,HANGRECS,HANGSECS,IEN123,IEN12340,NUMRECS,X,ZTSTOP
+2 ;Hang every 10,000 records for 10 seconds
SET HANGRECS=10000
SET HANGSECS=10
+3 SET (NUMRECS,ZTSTOP)=0
SET IEN123=$GET(^GMR(123,"ASTATUS",0),"@")
+4 FOR
SET IEN123=$ORDER(^GMR(123,IEN123),-1)
if 'IEN123!(ZTSTOP)
QUIT
Begin DoDot:1
+5 ;This is to allow re-entrance of this function after being manually shut down
SET ^GMR(123,"ASTATUS",0)=IEN123
+6 IF $$S^%ZTLOAD
Begin DoDot:2
+7 SET ZTSTOP=1
SET X=$$S^%ZTLOAD("GMRC*3.0*113 post-install received a shutdown request")
+8 DO MSG("GMRC*3.0*113 post-install received a shutdown request")
End DoDot:2
QUIT
+9 SET IEN12340=$ORDER(^GMR(123,IEN123,40,0))
if IEN12340?1.N
Begin DoDot:2
+10 KILL DA
SET DA=IEN12340
SET DA(1)=IEN123
+11 SET DIK="^GMR(123,"_DA(1)_",40,"
SET DIK(1)=".01^ASTATUS"
DO ENALL^DIK
+12 SET NUMRECS=NUMRECS+1
End DoDot:2
+13 if '(NUMRECS#HANGRECS)
HANG HANGSECS
End DoDot:1
+14 if 'ZTSTOP
KILL ^GMR(123,"ASTATUS",0)
+15 SET ZTREQ="@"
+16 IF 'ZTSTOP
DO MSG("GMRC*3.0*113 - the background job has finished setting up the new index ""ASTATUS""")
+17 IF '$TEST
Begin DoDot:1
+18 SET X="GMRC*3.0*113 - the background job was stopped whilst adding records to the new index ""ASTATUS"". "
+19 SET X=X_"If you re-install the patch, it will continue where it left off."
+20 DO MSG(X)
End DoDot:1
+21 QUIT
+22 ;
MSG(SUB) ;create and send message
+1 NEW XMDUZ,XMSUB,XMZ,XMTEXT,XMY
+2 NEW IEN,A,B,C,LNCNT
SET (IEN,A,B,C)=0
SET LNCNT=1
+3 SET XMY(DUZ)=""
+4 SET XMDUZ=DUZ
+5 SET XMSUB=SUB
+6 ; call Create Message Module
DO XMZ^XMA2
+7 SET XMTEXT="XMTEXT"
+8 SET XMTEXT(1)="GMRC*3.0*113 post-install background job received a shutdown request"
+9 SET XMTEXT(2)="- update of ""ASTATUS"" index aborted. if the patch is re-installed, the"
+10 SET XMTEXT(3)="update to the index will continue at the Consult IEN where it left off"
+11 SET XMTEXT(4)="in this run."
+12 DO ENL^XMD
+13 DO ENT1^XMD
+14 QUIT
+15 ;