47 lines
1.9 KiB
Mathematica
47 lines
1.9 KiB
Mathematica
|
AFJXPNHX ;FO-OAKLAND/GMB-PURGE MSGS ;11/8/95
|
||
|
;;5.1;Network Health Exchange;**1,6,11,17,20,24,31**;Jan 23, 1996
|
||
|
; Totally rewritten 11/2001. (Previously FJ/CWS.)
|
||
|
; Entry points:
|
||
|
; ENTER - invoked by option AFJXNH PURGE NIGHTLY
|
||
|
ENTER ;
|
||
|
N AXCUTOFF
|
||
|
S AXCUTOFF=$$FMADD^XLFDT(DT,-7) ; Days to keep on file - OK to change
|
||
|
D NHX(AXCUTOFF)
|
||
|
D DELST
|
||
|
D NITE(AXCUTOFF)
|
||
|
Q
|
||
|
NHX(AXCUTOFF) ;
|
||
|
N AXNHEDUZ,AXBSKT,AXMZ,AXDATE,DUZ
|
||
|
S (DUZ,AXNHEDUZ)=$$FIND1^DIC(200,"","X","NETWORK,HEALTH EXCHANGE","B") Q:'AXNHEDUZ
|
||
|
S AXBSKT=.9
|
||
|
F S AXBSKT=$O(^XMB(3.7,AXNHEDUZ,2,AXBSKT)) Q:'AXBSKT D
|
||
|
. S AXMZ=0
|
||
|
. F S AXMZ=$O(^XMB(3.7,AXNHEDUZ,2,AXBSKT,1,AXMZ)) Q:'AXMZ D
|
||
|
. . S AXDATE=$P($G(^XMB(3.9,AXMZ,0)),U,3)
|
||
|
. . S AXDATE=$S(AXDATE[".":$P(AXDATE,".",1),1:$$CONVERT^XMXUTIL1(AXDATE))
|
||
|
. . I AXDATE'>AXCUTOFF D DELMSG^XMXAPI(AXNHEDUZ,"",AXMZ) Q
|
||
|
. . I $$NEW^XMXUTIL2(AXNHEDUZ,AXBSKT,AXMZ) D NONEW^XMXUTIL(AXNHEDUZ,AXBSKT,AXMZ)
|
||
|
Q
|
||
|
DELST ;
|
||
|
N AX25IEN,AX25REC,AXDOMIEN,AXDAYS,AXI,AXDTRCVD,DA,DIK,AXCUTOFF
|
||
|
S (AX25IEN,AXI)=0
|
||
|
F S AX25IEN=$O(^AFJ(537025,AX25IEN)) Q:'AX25IEN D
|
||
|
. S AX25REC=$G(^AFJ(537025,AX25IEN,0))
|
||
|
. S AXDOMIEN=$P(AX25REC,U),AXDAYS=$P(AX25REC,U,5) Q:AXDOMIEN=""!'AXDAYS
|
||
|
. S AXCUTOFF=$$FMADD^XLFDT(DT,-AXDAYS)
|
||
|
. F S AXI=$O(^AFJ(537000,"C",AXDOMIEN,AXI)) Q:'AXI D
|
||
|
. . S AXDTRCVD=$P($G(^AFJ(537000,AXI,0)),U,2) ; Date Received
|
||
|
. . I AXDTRCVD<AXCUTOFF S DIK="^AFJ(537000,",DA=AXI D ^DIK
|
||
|
Q
|
||
|
NITE(AXCUTOFF) ; Nightly purge of messages in the AFJX server baskets
|
||
|
N AXSRV,AXBSKT,AXMZ,AXDATE,XMZ,XMSER
|
||
|
F AXSRV="S.AFJXSERVER","S.AFJXNHDONE","S.AFJXNETP" D
|
||
|
. S AXBSKT=$$FIND1^DIC(3.701,",.5,","X",AXSRV,"B") Q:'AXBSKT
|
||
|
. S AXMZ=0
|
||
|
. F S AXMZ=$O(^XMB(3.7,.5,2,AXBSKT,1,AXMZ)) Q:'AXMZ D
|
||
|
. . I $G(^XMB(3.9,AXMZ,0))="" S XMZ=AXMZ,XMSER=AXSRV D REMSBMSG^XMA1C Q
|
||
|
. . S AXDATE=$P(^XMB(3.9,AXMZ,0),U,3)
|
||
|
. . S AXDATE=$S(AXDATE[".":$P(AXDATE,".",1),1:$$CONVERT^XMXUTIL1(AXDATE))
|
||
|
. . I AXDATE<AXCUTOFF S XMZ=AXMZ,XMSER=AXSRV D REMSBMSG^XMA1C
|
||
|
Q
|