VDEFKIDS ;BPOIFO/JG - VDEF Patch Pre & Post Install ; 19 Dec 2005 3:06 PM
;;1.0;VDEF;**3**;Dec 28, 2004
;Per VHA Directive 2004-038, this routine should not be modified.
;
; IA: 10063 - $$ASKSTOP^%ZTLOAD
; 10063 - RTN^%ZTLOAD
; 10103 - $$FMADD^XLFDT
;
PREIN ; This program will suspend all VDEF Request Queues and stop
; the VDEF Monitor tasks for the install of this patch.
; It is run as the KIDS Environment Check Routine because
; if it is run as a Pre-Install routine, all the programs
; in the build are already loaded which may cause
; EDITED error trap errors.
;
I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
;
; Check for XU*8.0*339 patch
I '$L($T(JOB^%ZTLOAD)) W !,"XU*8.0*339 required for installation of this patch." S XPDABORT=1 Q
;
; Quit if loading a distribution, continue if installing.
Q:$G(XPDENV)'=1
W !!,"Suspending Request Queues and stopping associated TaskMan jobs"
NEW QUEUE,STAT,TMTASKC,TMTASKF,VDEFIDT,X,VDEFUP
S VDEFIDT=$$FMADD^XLFDT(DT,2)
K ^XTMP("VDEFP1") S ^XTMP("VDEFP1",0)=VDEFIDT_"^"_DT
;
; Suspend running Request Queues
S QUEUE=0 F S QUEUE=$O(^VDEFHL7(579.3,QUEUE)) Q:'QUEUE D
. S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="R" D
.. ; Suspend the request queue
.. S VDEFUP(579.3,QUEUE_",",.09)="S" D FILE^DIE("","VDEFUP")
.. ;
.. ; Stop the current & future TaskMan tasks
.. ; Wait up to 5 seconds for tasks to stop then delete them
.. ; anyway since that means the process probably died.
.. S TMTASKF=$$GET1^DIQ(579.3,QUEUE_",",.08,"I") ; Future
.. I TMTASKF'="" D
... N ZTSK S ZTSK=TMTASKF S X=$$ASKSTOP^%ZTLOAD(ZTSK)
... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
... K I D KILL^%ZTLOAD
.. S TMTASKC=$$GET1^DIQ(579.3,QUEUE_",",.11,"I") ; Current
.. I TMTASKC'=""&(TMTASKC'=TMTASKF) D
... N ZTSK S ZTSK=TMTASKC S X=$$ASKSTOP^%ZTLOAD(ZTSK)
... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
... K I D KILL^%ZTLOAD
.. S ^XTMP("VDEFP1",QUEUE)=""
;
; Stop the checked out request monitor
W !!,"Stopping the MONITOR^VDEFCONT task"
S ZTSK=$$GET1^DIQ(579.5,"1,",.06)
I ZTSK'="" D
. S X=$$ASKSTOP^%ZTLOAD(ZTSK)
. N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
. K I D KILL^%ZTLOAD
;
; Stop the Request Queue process monitor
W !!,"Stopping the MONITOR^VDEFMON task"
N TASK D RTN^%ZTLOAD("VDEFMON","TASK")
S ZTSK=$O(TASK(0)) I ZTSK D
. S X=$$ASKSTOP^%ZTLOAD(ZTSK)
. N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
. K I D KILL^%ZTLOAD
;
; Allow enough time for the VMS processes to quit.
W !!,"Waiting for processes to quit " N I F I=1:1:5 W ". " H 1
K I
Q
;
;
POSTIN ; This program will restart suspended Request Queues start the VDEF
; monitor processes after the KIDS install.
;
I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
;
; Don't start VDEF processes on test and Legacy systems
I '$$PROD^XUPROD(1) D BMES^XPDUTL("VDEF is not started on test systems.") Q
D BMES^XPDUTL("Starting the Request Queues and associated Tasks")
;
; For each Request Queue defined, change the status to
; 'Running' and start the Request Queue process for the queue.
NEW QUEUE,STAT,VDEFUP,I,QUENAM
S QUEUE=0 F S QUEUE=$O(^XTMP("VDEFP1",QUEUE)) Q:'QUEUE D
. S QUENAM=$P(^VDEFHL7(579.3,QUEUE,0),U)
. S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="S" D
.. S VDEFUP(579.3,QUEUE_",",.09)="R" D FILE^DIE("","VDEFUP")
.. F I=1:1:5 S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") Q:STAT="R" H 1
.. I STAT="R" D REQ^VDEFCONT(QUEUE)
.. E D BMES^XPDUTL("**** VDEF '"_QUENAM_"' QUEUE DID NOT START. START IT FROM VDEF CONFIG MENU.")
K ^XTMP("VDEFP1")
;
; Restart the Checked Out monitor process.
D BMES^XPDUTL("Starting the MONITOR^VDEFCONT task")
D MONCHKO^VDEFCONT
;
; Restart the Request Queue process monitor.
D BMES^XPDUTL("Starting the MONITOR^VDEFMON task")
D START1^VDEFMON
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVDEFKIDS 4022 printed Nov 22, 2024@17:53:44 Page 2
VDEFKIDS ;BPOIFO/JG - VDEF Patch Pre & Post Install ; 19 Dec 2005 3:06 PM
+1 ;;1.0;VDEF;**3**;Dec 28, 2004
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; IA: 10063 - $$ASKSTOP^%ZTLOAD
+5 ; 10063 - RTN^%ZTLOAD
+6 ; 10103 - $$FMADD^XLFDT
+7 ;
PREIN ; This program will suspend all VDEF Request Queues and stop
+1 ; the VDEF Monitor tasks for the install of this patch.
+2 ; It is run as the KIDS Environment Check Routine because
+3 ; if it is run as a Pre-Install routine, all the programs
+4 ; in the build are already loaded which may cause
+5 ; EDITED error trap errors.
+6 ;
+7 IF $GET(XPDNM)'?1"VDEF*".E
WRITE !,"Must be run as a KIDS Environment Check."
SET XPDABORT=1
QUIT
+8 ;
+9 ; Check for XU*8.0*339 patch
+10 IF '$LENGTH($TEXT(JOB^%ZTLOAD))
WRITE !,"XU*8.0*339 required for installation of this patch."
SET XPDABORT=1
QUIT
+11 ;
+12 ; Quit if loading a distribution, continue if installing.
+13 if $GET(XPDENV)'=1
QUIT
+14 WRITE !!,"Suspending Request Queues and stopping associated TaskMan jobs"
+15 NEW QUEUE,STAT,TMTASKC,TMTASKF,VDEFIDT,X,VDEFUP
+16 SET VDEFIDT=$$FMADD^XLFDT(DT,2)
+17 KILL ^XTMP("VDEFP1")
SET ^XTMP("VDEFP1",0)=VDEFIDT_"^"_DT
+18 ;
+19 ; Suspend running Request Queues
+20 SET QUEUE=0
FOR
SET QUEUE=$ORDER(^VDEFHL7(579.3,QUEUE))
if 'QUEUE
QUIT
Begin DoDot:1
+21 SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
IF STAT="R"
Begin DoDot:2
+22 ; Suspend the request queue
+23 SET VDEFUP(579.3,QUEUE_",",.09)="S"
DO FILE^DIE("","VDEFUP")
+24 ;
+25 ; Stop the current & future TaskMan tasks
+26 ; Wait up to 5 seconds for tasks to stop then delete them
+27 ; anyway since that means the process probably died.
+28 ; Future
SET TMTASKF=$$GET1^DIQ(579.3,QUEUE_",",.08,"I")
+29 IF TMTASKF'=""
Begin DoDot:3
+30 NEW ZTSK
SET ZTSK=TMTASKF
SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
+31 NEW I
FOR I=1:1:5
DO STAT^%ZTLOAD
if ZTSK(1)=0!(ZTSK(1)>2)
QUIT
HANG 1
+32 KILL I
DO KILL^%ZTLOAD
End DoDot:3
+33 ; Current
SET TMTASKC=$$GET1^DIQ(579.3,QUEUE_",",.11,"I")
+34 IF TMTASKC'=""&(TMTASKC'=TMTASKF)
Begin DoDot:3
+35 NEW ZTSK
SET ZTSK=TMTASKC
SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
+36 NEW I
FOR I=1:1:5
DO STAT^%ZTLOAD
if ZTSK(1)=0!(ZTSK(1)>2)
QUIT
HANG 1
+37 KILL I
DO KILL^%ZTLOAD
End DoDot:3
+38 SET ^XTMP("VDEFP1",QUEUE)=""
End DoDot:2
End DoDot:1
+39 ;
+40 ; Stop the checked out request monitor
+41 WRITE !!,"Stopping the MONITOR^VDEFCONT task"
+42 SET ZTSK=$$GET1^DIQ(579.5,"1,",.06)
+43 IF ZTSK'=""
Begin DoDot:1
+44 SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
+45 NEW I
FOR I=1:1:5
DO STAT^%ZTLOAD
if ZTSK(1)=0!(ZTSK(1)>2)
QUIT
HANG 1
+46 KILL I
DO KILL^%ZTLOAD
End DoDot:1
+47 ;
+48 ; Stop the Request Queue process monitor
+49 WRITE !!,"Stopping the MONITOR^VDEFMON task"
+50 NEW TASK
DO RTN^%ZTLOAD("VDEFMON","TASK")
+51 SET ZTSK=$ORDER(TASK(0))
IF ZTSK
Begin DoDot:1
+52 SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
+53 NEW I
FOR I=1:1:5
DO STAT^%ZTLOAD
if ZTSK(1)=0!(ZTSK(1)>2)
QUIT
HANG 1
+54 KILL I
DO KILL^%ZTLOAD
End DoDot:1
+55 ;
+56 ; Allow enough time for the VMS processes to quit.
+57 WRITE !!,"Waiting for processes to quit "
NEW I
FOR I=1:1:5
WRITE ". "
HANG 1
+58 KILL I
+59 QUIT
+60 ;
+61 ;
POSTIN ; This program will restart suspended Request Queues start the VDEF
+1 ; monitor processes after the KIDS install.
+2 ;
+3 IF $GET(XPDNM)'?1"VDEF*".E
WRITE !,"Must be run as a KIDS Environment Check."
SET XPDABORT=1
QUIT
+4 ;
+5 ; Don't start VDEF processes on test and Legacy systems
+6 IF '$$PROD^XUPROD(1)
DO BMES^XPDUTL("VDEF is not started on test systems.")
QUIT
+7 DO BMES^XPDUTL("Starting the Request Queues and associated Tasks")
+8 ;
+9 ; For each Request Queue defined, change the status to
+10 ; 'Running' and start the Request Queue process for the queue.
+11 NEW QUEUE,STAT,VDEFUP,I,QUENAM
+12 SET QUEUE=0
FOR
SET QUEUE=$ORDER(^XTMP("VDEFP1",QUEUE))
if 'QUEUE
QUIT
Begin DoDot:1
+13 SET QUENAM=$PIECE(^VDEFHL7(579.3,QUEUE,0),U)
+14 SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
IF STAT="S"
Begin DoDot:2
+15 SET VDEFUP(579.3,QUEUE_",",.09)="R"
DO FILE^DIE("","VDEFUP")
+16 FOR I=1:1:5
SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
if STAT="R"
QUIT
HANG 1
+17 IF STAT="R"
DO REQ^VDEFCONT(QUEUE)
+18 IF '$TEST
DO BMES^XPDUTL("**** VDEF '"_QUENAM_"' QUEUE DID NOT START. START IT FROM VDEF CONFIG MENU.")
End DoDot:2
End DoDot:1
+19 KILL ^XTMP("VDEFP1")
+20 ;
+21 ; Restart the Checked Out monitor process.
+22 DO BMES^XPDUTL("Starting the MONITOR^VDEFCONT task")
+23 DO MONCHKO^VDEFCONT
+24 ;
+25 ; Restart the Request Queue process monitor.
+26 DO BMES^XPDUTL("Starting the MONITOR^VDEFMON task")
+27 DO START1^VDEFMON
+28 QUIT