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

XMUT4C.m

Go to the documentation of this file.
  1. XMUT4C ;ISC-SF/GMB-Integrity Checker for file 3.9 ;04/19/2002 13:00
  1. ;;8.0;MailMan;;Jun 28, 2002
  1. ; Was (WASH ISC)/CAP
  1. MESSAGE(XMABORT) ;
  1. N XMZ,XMCNT,XMZREC,XMCRE8
  1. W !!,$$EZBLD^DIALOG(36094),! ; Checking MESSAGE file 3.9
  1. F S XMZ=$O(^XMB(3.9,":"),-1) Q:XMZ?1N.N D BOGUS(XMZ)
  1. S (XMZ,XMCNT)=0
  1. F S XMZ=$O(^XMB(3.9,XMZ)) Q:XMZ'>0 D Q:XMABORT
  1. . I XMZ'?1N.N D BOGUS(XMZ) Q
  1. . S XMCNT=XMCNT+1 I XMCNT#5000=0 D Q:XMABORT
  1. . . I '$D(ZTQUEUED) W:$X>40 ! W XMCNT,"." Q
  1. . . I $$S^%ZTLOAD S (XMABORT,ZTSTOP)=1 ; User asked the task to stop
  1. . S XMZREC=$G(^XMB(3.9,XMZ,0))
  1. . I "^^^^^^^^"[XMZREC D
  1. . . D ERR(XMZ,201) ; Msg has bad/no 0 node: not fixed
  1. . E D
  1. . . D SUBJ(XMZ,XMZREC)
  1. . . I $P(XMZREC,U,2)="" D
  1. . . . S $P(^XMB(3.9,XMZ,0),U,2)=$$EZBLD^DIALOG(34009) ;* No Name *
  1. . . . D ERR(XMZ,206) ; Msg has no sender: fixed
  1. . . I $P(XMZREC,U,3)="" D
  1. . . . S $P(^XMB(3.9,XMZ,0),U,3)=DT
  1. . . . D ERR(XMZ,207) ; Msg has no date/time: fixed
  1. . D CRE8DT(XMZ,$P(XMZREC,U,3))
  1. . D RESP(XMZ,XMZREC)
  1. . D:$D(^XMB(3.9,XMZ,1)) RECIP(XMZ)
  1. Q:XMABORT
  1. W !!,$$EZBLD^DIALOG(36093,XMCNT) ; |1| messages in the MESSAGE file 3.9
  1. I XMCNT=$P(^XMB(3.9,0),U,4) W !,$$EZBLD^DIALOG(36095) Q ; Zero node is OK
  1. L +^XMB(3.9,0):1
  1. S $P(^XMB(3.9,0),U,4)=XMCNT
  1. L -^XMB(3.9,0)
  1. W !,$$EZBLD^DIALOG(36096) ; I reset the zero node.
  1. Q
  1. BOGUS(XMZ) ;
  1. D ERR(XMZ,210) ; Msg IEN is corrupted: fixed
  1. I $L($P($G(^XMB(3.9,XMZ,0)),U,1)) K ^XMB(3.9,"B",$E($P(^XMB(3.9,XMZ,0),U,1),1,30),XMZ)
  1. K ^XMB(3.9,"C",+$P($G(^XMB(3.9,XMZ,.6)),U,1),XMZ)
  1. K ^XMB(3.9,XMZ)
  1. Q
  1. SUBJ(XMZ,XMZREC) ;
  1. N XMSUBJ
  1. S XMSUBJ=$P(XMZREC,U)
  1. I XMSUBJ="" D
  1. . S XMSUBJ=$$EZBLD^DIALOG(34012) ;* No Subject *
  1. . S $P(^XMB(3.9,XMZ,0),U,1)=XMSUBJ
  1. . S ^XMB(3.9,"B",XMSUBJ,XMZ)=""
  1. . D ERR(XMZ,202) ; Msg has no subject: fixed
  1. I '$D(^XMB(3.9,"B",$E(XMSUBJ,1,30),XMZ)) D
  1. . I $L(XMSUBJ)>30,$D(^XMB(3.9,"B",XMSUBJ,XMZ)) D
  1. . . K ^XMB(3.9,"B",XMSUBJ,XMZ)
  1. . . D ERR(XMZ,205) ; Subject B xref too long: xref shortened
  1. . E D ERR(XMZ,204) ; Subject has no B xref: xref created
  1. . S ^XMB(3.9,"B",$E(XMSUBJ,1,30),XMZ)=""
  1. I $L(XMSUBJ)<3!($L(XMSUBJ)>65) D
  1. . D ERR(XMZ,203) ; Msg subject <3 or >65: fixed
  1. . S XMSUBJ=$S($L(XMSUBJ)<3:XMSUBJ_"...",1:$E(XMSUBJ,1,65))
  1. . N XMFDA
  1. . S XMFDA(3.9,XMZ_",",.01)=XMSUBJ
  1. . D FILE^DIE("","XMFDA")
  1. Q
  1. RESP(XMZ,XMZREC) ;
  1. N XMZO
  1. I $P(XMZREC,U,8) D Q
  1. . S XMZO=$P(XMZREC,U,8)
  1. . I XMZO=XMZ D Q
  1. . . D ERR(XMZ,211) ; Message thinks it's a response to itself: fixed
  1. . . S $P(^XMB(3.9,XMZ,0),U,8)=""
  1. . I '$D(^XMB(3.9,XMZO,0)) D Q
  1. . . D ERR(XMZ,212,XMZO) ; No original message |1| for this response: fixed
  1. . . S $P(^XMB(3.9,XMZ,0),U,8)=""
  1. . I $$ATTACHED(XMZO,XMZ) Q
  1. . D ERR(XMZ,213,XMZO) ; Not in response chain of |1|: fixed
  1. . S $P(^XMB(3.9,XMZ,0),U,8)=""
  1. N XMSUBJ
  1. S XMSUBJ=$P(XMZREC,U)
  1. Q:XMSUBJ'?1"R"1.N
  1. Q:$P(XMZREC,U,2)["@"
  1. S XMZO=+$E(XMSUBJ,2,99)
  1. I '$D(^XMB(3.9,XMZO,0)) D Q
  1. . D ERR(XMZ,216,XMZO) ; No original message |1| for this response: not fixed
  1. I '$$ATTACHED(XMZO,XMZ) D Q
  1. . D ERR(XMZ,217,XMZO) ; Not in response chain of |1|: not fixed
  1. D ERR(XMZ,218,XMZO) ; Piece 8 didn't point to original message |1|: fixed
  1. S $P(^XMB(3.9,XMZ,0),U,8)=XMZO
  1. Q
  1. ATTACHED(XMZO,XMZ) ; Is XMZ in the response chain of XMZO?
  1. N I
  1. S I=0
  1. F S I=$O(^XMB(3.9,XMZO,3,I)) Q:'I Q:$P($G(^(I,0)),U)=XMZ
  1. Q +I
  1. CRE8DT(XMZ,XMDATE) ;
  1. S XMCRE8=$P($G(^XMB(3.9,XMZ,.6)),U,1)
  1. I 'XMCRE8 D Q
  1. . I $P(XMDATE,".",1)?7N S XMDATE=$P(XMDATE,".",1)
  1. . E I XMDATE="" S XMDATE=DT
  1. . E D
  1. . . S XMDATE=$$CONVERT^XMXUTIL1(XMDATE)
  1. . . S:XMDATE=-1 XMDATE=DT
  1. . S $P(^XMB(3.9,XMZ,.6),U,1)=XMDATE
  1. . S ^XMB(3.9,"C",XMDATE,XMZ)=""
  1. . D ERR(XMZ,208) ; Msg has no local create date: fixed
  1. I '$D(^XMB(3.9,"C",XMCRE8,XMZ)) D
  1. . S ^XMB(3.9,"C",XMCRE8,XMZ)=""
  1. . D ERR(XMZ,209) ; Local create date C xref missing: fixed
  1. Q
  1. RECIP(XMZ) ; Check recipient multiple
  1. N I,XMVAL,XMXREF,XMRECIPS
  1. D CXREF(XMZ)
  1. S (I,XMRECIPS)=0
  1. F S I=$O(^XMB(3.9,XMZ,1,I)) Q:'I D
  1. . S XMVAL=$P($G(^XMB(3.9,XMZ,1,I,0)),U)
  1. . I XMVAL="" D Q
  1. . . Q:$P(^XMB(3.9,XMZ,.6),U,1)=DT
  1. . . K ^XMB(3.9,XMZ,1,I)
  1. . . D ERR(XMZ,221,I) ; Recipient |1| null, no C xref: fixed
  1. . S XMRECIPS=XMRECIPS+1
  1. . Q:$D(^XMB(3.9,XMZ,1,"C",$E(XMVAL,1,30),I))
  1. . I $L(XMVAL)>30,$D(^XMB(3.9,XMZ,1,"C",XMVAL,I)) D Q
  1. . . ;K ^XMB(3.9,XMZ,1,"C",XMVAL,I)
  1. . . ;D ERR(XMZ,223,I) ; Recipient |1| C xref too long: xref shortened
  1. . . ;S ^XMB(3.9,XMZ,1,"C",$E(XMVAL,1,30),I)=""
  1. . D ERR(XMZ,222,I) ; Recipient |1| no C xref: xref created
  1. . S ^XMB(3.9,XMZ,1,"C",$E(XMVAL,1,30),I)=""
  1. I $D(^XMB(3.9,XMZ,1,0)) S:$P(^XMB(3.9,XMZ,1,0),U,4)'=XMRECIPS $P(^(0),U,4)=XMRECIPS Q
  1. S ^XMB(3.9,XMZ,1,0)="^3.91A^"_I_U_XMRECIPS
  1. Q
  1. CXREF(XMZ) ; Check C xref for Recipient multiple
  1. N I,XMVAL,XMXREF
  1. S (I,XMXREF)=""
  1. F S XMXREF=$O(^XMB(3.9,XMZ,1,"C",XMXREF)) Q:XMXREF="" D
  1. . F S I=$O(^XMB(3.9,XMZ,1,"C",XMXREF,I)) Q:'I D
  1. . . S XMVAL=$P($G(^XMB(3.9,XMZ,1,I,0)),U)
  1. . . Q:$E(XMVAL,1,30)=$E(XMXREF,1,30)
  1. . . I XMVAL="" D Q
  1. . . . S $P(^XMB(3.9,XMZ,1,I,0),U)=XMXREF
  1. . . . I $L(XMXREF)<30 D ERR(XMZ,231,I) Q ; C xref, but recip |1| null: fixed using xref
  1. . . . D ERR(XMZ,232,I) ; C xref, but recip |1| null: fixed, but CHECK
  1. . . K ^XMB(3.9,XMZ,1,"C",XMXREF,I)
  1. . . D ERR(XMZ,233,I) ; C xref for recip |1| doesn't match recip: xref killed
  1. Q
  1. ERR(XMZ,XMERRNUM,XMDPARM) ;
  1. N XMPARM
  1. S XMERROR(XMERRNUM)=$G(XMERROR(XMERRNUM))+1
  1. S XMPARM(1)=XMZ,XMPARM(2)=$J(XMERRNUM,3)
  1. S XMPARM(3)=$$EZBLD^DIALOG(36300+XMERRNUM,.XMDPARM)
  1. W !,$$EZBLD^DIALOG(36097,.XMPARM) ;Msg=|1|, Err=|2| |3|
  1. Q