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

XMUTPUR0.m

Go to the documentation of this file.
  1. XMUTPUR0 ;(KVAMC)/XXX-Purge "AI" X-ref ;01/21/2003 07:50
  1. ;;8.0;MailMan;**10**;Jun 28, 2002
  1. ; Entry points used by MailMan options (not covered by DBIA):
  1. ; PURGE XMMGR-PURGE-AI-XREF
  1. PURGE ;
  1. N XMQUIET,XMABORT,XMDT
  1. S XMABORT=0,XMQUIET=$D(ZTQUEUED)!($E(IOST,1,2)'="C-")
  1. D INIT(.XMDT,XMQUIET,.XMABORT)
  1. I XMABORT W:'XMQUIET !,"Process aborted." Q
  1. D PROCESS(XMDT,XMQUIET)
  1. Q
  1. INIT(XMDT,XMQUIET,XMABORT) ;
  1. I $D(^XMBX(3.9,"AI"))<10 S XMABORT=1 W:'XMQUIET !,"XMBX Global 'AI' Node empty!" Q
  1. S XMDT=$$FMADD^XLFDT(DT,-730)
  1. Q:XMQUIET
  1. N DIR,X,Y
  1. S DIR(0)="D^:"_$$FMADD^XLFDT(DT,-1)_":EP"
  1. S DIR("A")="Kill all XMBX 'AI' nodes older than"
  1. S DIR("B")=$$FMTE^XLFDT(XMDT)
  1. D ^DIR I $D(DIRUT) S XMABORT=1 Q
  1. I XMDT'=Y D Q:XMABORT
  1. . S XMDT=Y
  1. . K DIR,X,Y
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Are you sure"
  1. . S DIR("B")="NO"
  1. . D ^DIR I 'Y!$D(DIRUT) S XMABORT=1
  1. W !,"We will kill all nodes older than ",$$FMTE^XLFDT(XMDT),"."
  1. W !!,"***** Starting at ",$P($$HTE^XLFDT($H),"@",2),!
  1. Q
  1. PROCESS(XMDT,XMQUIET) ;
  1. N XMS,XMI,XMZ,XMXDT,XMCNT,XMKILL
  1. S (XMCNT,XMKILL)=0 ; XMCNT=#nodes, XMKILL=#killed
  1. S (XMS,XMI,XMZ)="" ; XMS=Site, XMI=Msg ID, XMZ=Msg # here at this site
  1. F S XMS=$O(^XMBX(3.9,"AI",XMS)) Q:XMS="" D
  1. . F S XMI=$O(^XMBX(3.9,"AI",XMS,XMI)) Q:XMI="" D
  1. . . S XMZ=$O(^XMBX(3.9,"AI",XMS,XMI,""))
  1. . . I XMZ="" K ^XMBX(3.9,"AI",XMS,XMI) Q
  1. . . S XMXDT=$G(^XMBX(3.9,"AI",XMS,XMI,XMZ))
  1. . . S XMCNT=XMCNT+1
  1. . . I 'XMQUIET,XMCNT#1000=0 W:$X>70 ! W ".",XMCNT
  1. . . I 'XMXDT S ^XMBX(3.9,"AI",XMS,XMI,XMZ)=DT Q
  1. . . I XMXDT<XMDT K ^XMBX(3.9,"AI",XMS,XMI,XMZ) S XMKILL=XMKILL+1
  1. Q:XMQUIET
  1. W !,"Nodes Reviewed:",?16,$J($FN(XMCNT,","),10),!,"Nodes Killed:",?16,$J($FN(XMKILL,","),10),!,"Nodes Remaining:",?16,$J($FN(XMCNT-XMKILL,","),10)
  1. W !,"***** Finished at ",$P($$HTE^XLFDT($H),"@",2)
  1. Q