- VDEFP10 ;BPOIFO/JG/CJM - VDEF Patch Pre & Post Install ;08/18/2011
- ;;1.0;VDEF;**10**;Dec 28, 2004;Build 2
- ;Per VHA Directive 2004-038, this routine should not be modified.
- ;
- ;
- PRE ; This program will suspend all VDEF Request Queues and stop
- ; the VDEF Monitor tasks for the install of this patch.
- ;
- D BMES^XPDUTL("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
- D BMES^XPDUTL("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
- D BMES^XPDUTL("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.
- D BMES^XPDUTL("Waiting for processes to quit .....") H 5
- Q
- ;
- ;
- POST ; This program will restart suspended Request Queues start the VDEF
- ; monitor processes after the KIDS install.
- ;
- ;
- ; 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[HVDEFP10 3352 printed Mar 13, 2025@21:48:56 Page 2
- VDEFP10 ;BPOIFO/JG/CJM - VDEF Patch Pre & Post Install ;08/18/2011
- +1 ;;1.0;VDEF;**10**;Dec 28, 2004;Build 2
- +2 ;Per VHA Directive 2004-038, this routine should not be modified.
- +3 ;
- +4 ;
- PRE ; This program will suspend all VDEF Request Queues and stop
- +1 ; the VDEF Monitor tasks for the install of this patch.
- +2 ;
- +3 DO BMES^XPDUTL("Suspending Request Queues and stopping associated TaskMan jobs")
- +4 NEW QUEUE,STAT,TMTASKC,TMTASKF,VDEFIDT,X,VDEFUP
- +5 SET VDEFIDT=$$FMADD^XLFDT(DT,2)
- +6 KILL ^XTMP("VDEFP1")
- SET ^XTMP("VDEFP1",0)=VDEFIDT_"^"_DT
- +7 ;
- +8 ; Suspend running Request Queues
- +9 SET QUEUE=0
- FOR
- SET QUEUE=$ORDER(^VDEFHL7(579.3,QUEUE))
- if 'QUEUE
- QUIT
- Begin DoDot:1
- +10 SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
- IF STAT="R"
- Begin DoDot:2
- +11 ; Suspend the request queue
- +12 SET VDEFUP(579.3,QUEUE_",",.09)="S"
- DO FILE^DIE("","VDEFUP")
- +13 ;
- +14 ; Stop the current & future TaskMan tasks
- +15 ; Wait up to 5 seconds for tasks to stop then delete them
- +16 ; anyway since that means the process probably died.
- +17 ; Future
- SET TMTASKF=$$GET1^DIQ(579.3,QUEUE_",",.08,"I")
- +18 IF TMTASKF'=""
- Begin DoDot:3
- +19 NEW ZTSK
- SET ZTSK=TMTASKF
- SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
- +20 NEW I
- FOR I=1:1:5
- DO STAT^%ZTLOAD
- if ZTSK(1)=0!(ZTSK(1)>2)
- QUIT
- HANG 1
- +21 KILL I
- DO KILL^%ZTLOAD
- End DoDot:3
- +22 ; Current
- SET TMTASKC=$$GET1^DIQ(579.3,QUEUE_",",.11,"I")
- +23 IF TMTASKC'=""&(TMTASKC'=TMTASKF)
- Begin DoDot:3
- +24 NEW ZTSK
- SET ZTSK=TMTASKC
- SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
- +25 NEW I
- FOR I=1:1:5
- DO STAT^%ZTLOAD
- if ZTSK(1)=0!(ZTSK(1)>2)
- QUIT
- HANG 1
- +26 KILL I
- DO KILL^%ZTLOAD
- End DoDot:3
- +27 SET ^XTMP("VDEFP1",QUEUE)=""
- End DoDot:2
- End DoDot:1
- +28 ;
- +29 ; Stop the checked out request monitor
- +30 DO BMES^XPDUTL("Stopping the MONITOR^VDEFCONT task")
- +31 SET ZTSK=$$GET1^DIQ(579.5,"1,",.06)
- +32 IF ZTSK'=""
- Begin DoDot:1
- +33 SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
- +34 NEW I
- FOR I=1:1:5
- DO STAT^%ZTLOAD
- if ZTSK(1)=0!(ZTSK(1)>2)
- QUIT
- HANG 1
- +35 KILL I
- DO KILL^%ZTLOAD
- End DoDot:1
- +36 ;
- +37 ; Stop the Request Queue process monitor
- +38 DO BMES^XPDUTL("Stopping the MONITOR^VDEFMON task")
- +39 NEW TASK
- DO RTN^%ZTLOAD("VDEFMON","TASK")
- +40 SET ZTSK=$ORDER(TASK(0))
- IF ZTSK
- Begin DoDot:1
- +41 SET X=$$ASKSTOP^%ZTLOAD(ZTSK)
- +42 NEW I
- FOR I=1:1:5
- DO STAT^%ZTLOAD
- if ZTSK(1)=0!(ZTSK(1)>2)
- QUIT
- HANG 1
- +43 KILL I
- DO KILL^%ZTLOAD
- End DoDot:1
- +44 ;
- +45 ; Allow enough time for the VMS processes to quit.
- +46 DO BMES^XPDUTL("Waiting for processes to quit .....")
- HANG 5
- +47 QUIT
- +48 ;
- +49 ;
- POST ; This program will restart suspended Request Queues start the VDEF
- +1 ; monitor processes after the KIDS install.
- +2 ;
- +3 ;
- +4 ; Don't start VDEF processes on test and Legacy systems
- +5 IF '$$PROD^XUPROD(1)
- DO BMES^XPDUTL("VDEF is not started on test systems.")
- QUIT
- +6 DO BMES^XPDUTL("Starting the Request Queues and associated Tasks")
- +7 ;
- +8 ; For each Request Queue defined, change the status to
- +9 ; 'Running' and start the Request Queue process for the queue.
- +10 NEW QUEUE,STAT,VDEFUP,I,QUENAM
- +11 SET QUEUE=0
- FOR
- SET QUEUE=$ORDER(^XTMP("VDEFP1",QUEUE))
- if 'QUEUE
- QUIT
- Begin DoDot:1
- +12 SET QUENAM=$PIECE(^VDEFHL7(579.3,QUEUE,0),U)
- +13 SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
- IF STAT="S"
- Begin DoDot:2
- +14 SET VDEFUP(579.3,QUEUE_",",.09)="R"
- DO FILE^DIE("","VDEFUP")
- +15 FOR I=1:1:5
- SET STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I")
- if STAT="R"
- QUIT
- HANG 1
- +16 IF STAT="R"
- DO REQ^VDEFCONT(QUEUE)
- +17 IF '$TEST
- DO BMES^XPDUTL("**** VDEF '"_QUENAM_"' QUEUE DID NOT START. START IT FROM VDEF CONFIG MENU.")
- End DoDot:2
- End DoDot:1
- +18 KILL ^XTMP("VDEFP1")
- +19 ;
- +20 ; Restart the Checked Out monitor process.
- +21 DO BMES^XPDUTL("Starting the MONITOR^VDEFCONT task")
- +22 DO MONCHKO^VDEFCONT
- +23 ;
- +24 ; Restart the Request Queue process monitor.
- +25 DO BMES^XPDUTL("Starting the MONITOR^VDEFMON task")
- +26 DO START1^VDEFMON
- +27 QUIT