Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VDEFKIDS

VDEFKIDS.m

Go to the documentation of this file.
  1. VDEFKIDS ;BPOIFO/JG - VDEF Patch Pre & Post Install ; 19 Dec 2005 3:06 PM
  1. ;;1.0;VDEF;**3**;Dec 28, 2004
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; IA: 10063 - $$ASKSTOP^%ZTLOAD
  1. ; 10063 - RTN^%ZTLOAD
  1. ; 10103 - $$FMADD^XLFDT
  1. ;
  1. PREIN ; This program will suspend all VDEF Request Queues and stop
  1. ; the VDEF Monitor tasks for the install of this patch.
  1. ; It is run as the KIDS Environment Check Routine because
  1. ; if it is run as a Pre-Install routine, all the programs
  1. ; in the build are already loaded which may cause
  1. ; EDITED error trap errors.
  1. ;
  1. I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
  1. ;
  1. ; Check for XU*8.0*339 patch
  1. I '$L($T(JOB^%ZTLOAD)) W !,"XU*8.0*339 required for installation of this patch." S XPDABORT=1 Q
  1. ;
  1. ; Quit if loading a distribution, continue if installing.
  1. Q:$G(XPDENV)'=1
  1. W !!,"Suspending Request Queues and stopping associated TaskMan jobs"
  1. NEW QUEUE,STAT,TMTASKC,TMTASKF,VDEFIDT,X,VDEFUP
  1. S VDEFIDT=$$FMADD^XLFDT(DT,2)
  1. K ^XTMP("VDEFP1") S ^XTMP("VDEFP1",0)=VDEFIDT_"^"_DT
  1. ;
  1. ; Suspend running Request Queues
  1. S QUEUE=0 F S QUEUE=$O(^VDEFHL7(579.3,QUEUE)) Q:'QUEUE D
  1. . S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="R" D
  1. .. ; Suspend the request queue
  1. .. S VDEFUP(579.3,QUEUE_",",.09)="S" D FILE^DIE("","VDEFUP")
  1. .. ;
  1. .. ; Stop the current & future TaskMan tasks
  1. .. ; Wait up to 5 seconds for tasks to stop then delete them
  1. .. ; anyway since that means the process probably died.
  1. .. S TMTASKF=$$GET1^DIQ(579.3,QUEUE_",",.08,"I") ; Future
  1. .. I TMTASKF'="" D
  1. ... N ZTSK S ZTSK=TMTASKF S X=$$ASKSTOP^%ZTLOAD(ZTSK)
  1. ... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
  1. ... K I D KILL^%ZTLOAD
  1. .. S TMTASKC=$$GET1^DIQ(579.3,QUEUE_",",.11,"I") ; Current
  1. .. I TMTASKC'=""&(TMTASKC'=TMTASKF) D
  1. ... N ZTSK S ZTSK=TMTASKC S X=$$ASKSTOP^%ZTLOAD(ZTSK)
  1. ... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
  1. ... K I D KILL^%ZTLOAD
  1. .. S ^XTMP("VDEFP1",QUEUE)=""
  1. ;
  1. ; Stop the checked out request monitor
  1. W !!,"Stopping the MONITOR^VDEFCONT task"
  1. S ZTSK=$$GET1^DIQ(579.5,"1,",.06)
  1. I ZTSK'="" D
  1. . S X=$$ASKSTOP^%ZTLOAD(ZTSK)
  1. . N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
  1. . K I D KILL^%ZTLOAD
  1. ;
  1. ; Stop the Request Queue process monitor
  1. W !!,"Stopping the MONITOR^VDEFMON task"
  1. N TASK D RTN^%ZTLOAD("VDEFMON","TASK")
  1. S ZTSK=$O(TASK(0)) I ZTSK D
  1. . S X=$$ASKSTOP^%ZTLOAD(ZTSK)
  1. . N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
  1. . K I D KILL^%ZTLOAD
  1. ;
  1. ; Allow enough time for the VMS processes to quit.
  1. W !!,"Waiting for processes to quit " N I F I=1:1:5 W ". " H 1
  1. K I
  1. Q
  1. ;
  1. ;
  1. POSTIN ; This program will restart suspended Request Queues start the VDEF
  1. ; monitor processes after the KIDS install.
  1. ;
  1. I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
  1. ;
  1. ; Don't start VDEF processes on test and Legacy systems
  1. I '$$PROD^XUPROD(1) D BMES^XPDUTL("VDEF is not started on test systems.") Q
  1. D BMES^XPDUTL("Starting the Request Queues and associated Tasks")
  1. ;
  1. ; For each Request Queue defined, change the status to
  1. ; 'Running' and start the Request Queue process for the queue.
  1. NEW QUEUE,STAT,VDEFUP,I,QUENAM
  1. S QUEUE=0 F S QUEUE=$O(^XTMP("VDEFP1",QUEUE)) Q:'QUEUE D
  1. . S QUENAM=$P(^VDEFHL7(579.3,QUEUE,0),U)
  1. . S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="S" D
  1. .. S VDEFUP(579.3,QUEUE_",",.09)="R" D FILE^DIE("","VDEFUP")
  1. .. F I=1:1:5 S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") Q:STAT="R" H 1
  1. .. I STAT="R" D REQ^VDEFCONT(QUEUE)
  1. .. E D BMES^XPDUTL("**** VDEF '"_QUENAM_"' QUEUE DID NOT START. START IT FROM VDEF CONFIG MENU.")
  1. K ^XTMP("VDEFP1")
  1. ;
  1. ; Restart the Checked Out monitor process.
  1. D BMES^XPDUTL("Starting the MONITOR^VDEFCONT task")
  1. D MONCHKO^VDEFCONT
  1. ;
  1. ; Restart the Request Queue process monitor.
  1. D BMES^XPDUTL("Starting the MONITOR^VDEFMON task")
  1. D START1^VDEFMON
  1. Q