HLOCLNT3 ;ALB/CJM- Updates messages missing application acks - 10/4/94 1pm
;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
;
DOWORK(WORK) ;
;
N CUTOFF,MSGIEN,QUIT
S QUIT=0
;
;7 day wait for an application ack is more than reasonable
S CUTOFF=$$FMADD^XLFDT($$NOW^XLFDT,-3)
;
S MSGIEN=+$G(^HLTMP("LAST IEN CHECKED FOR MISSING APPLICATION ACK"))
F S MSGIEN=$O(^HLB(MSGIEN)) Q:'MSGIEN Q:MSGIEN>99999999999 D Q:QUIT
.N MSG,HDR
.Q:'$$GETMSG^HLOMSG(MSGIEN,.MSG)
.Q:'MSG("DT/TM")
.Q:'MSG("BODY")
.I MSG("DT/TM")>CUTOFF S:MSG("DT/TM CREATED")>CUTOFF QUIT=1,MSGIEN=MSGIEN-1 Q
.Q:MSG("STATUS")'=""
.Q:MSG("DIRECTION")'="OUT"
.Q:MSG("BATCH")
.Q:MSG("STATUS","APP ACK'D")
.;Q:MSG("STATUS","APP ACK RESPONSE")=""
.;message has been in a non-complete status for a longtime, pending an application ack - set status to error
.S $P(^HLB(MSGIEN,0),"^",20)="AE"
.S $P(^HLB(MSGIEN,0),"^",21)="MISSING APPLICATION ACKNOWLEDGMENT"
.M HDR=MSG("HDR")
.Q:'$$PARSEHDR^HLOPRS(.HDR)
.S ^HLB("ERRORS","AE",$S($L(HDR("RECEIVING APPLICATION")):HDR("RECEIVING APPLICATION"),1:"UNKNOWN"),MSG("DT/TM CREATED"),MSGIEN)=""
S:MSGIEN>99999999999 MSGIEN=0
S ^HLTMP("LAST IEN CHECKED FOR MISSING APPLICATION ACK")=MSGIEN
Q
HLOCLNT3 ;ALB/CJM- Updates messages missing application acks - 10/4/94 1pm
+1 ;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
+2 ;
DOWORK(WORK) ;
+1 ;
+2 NEW CUTOFF,MSGIEN,QUIT
+3 SET QUIT=0
+4 ;
+5 ;7 day wait for an application ack is more than reasonable
+6 SET CUTOFF=$$FMADD^XLFDT($$NOW^XLFDT,-3)
+7 ;
+8 SET MSGIEN=+$GET(^HLTMP("LAST IEN CHECKED FOR MISSING APPLICATION ACK"))
+9 FOR
SET MSGIEN=$ORDER(^HLB(MSGIEN))
IF 'MSGIEN
QUIT
IF MSGIEN>99999999999
QUIT
Begin DoDot:1
+10 NEW MSG,HDR
+11 IF '$$GETMSG^HLOMSG(MSGIEN,.MSG)
QUIT
+12 IF 'MSG("DT/TM")
QUIT
+13 IF 'MSG("BODY")
QUIT
+14 IF MSG("DT/TM")>CUTOFF
IF MSG("DT/TM CREATED")>CUTOFF
SET QUIT=1
SET MSGIEN=MSGIEN-1
QUIT
+15 IF MSG("STATUS")'=""
QUIT
+16 IF MSG("DIRECTION")'="OUT"
QUIT
+17 IF MSG("BATCH")
QUIT
+18 IF MSG("STATUS","APP ACK'D")
QUIT
+19 ;Q:MSG("STATUS","APP ACK RESPONSE")=""
+20 ;message has been in a non-complete status for a longtime, pending an application ack - set status to error
+21 SET $PIECE(^HLB(MSGIEN,0),"^",20)="AE"
+22 SET $PIECE(^HLB(MSGIEN,0),"^",21)="MISSING APPLICATION ACKNOWLEDGMENT"
+23 MERGE HDR=MSG("HDR")
+24 IF '$$PARSEHDR^HLOPRS(.HDR)
QUIT
+25 SET ^HLB("ERRORS","AE",$SELECT($LENGTH(HDR("RECEIVING APPLICATION")):HDR("RECEIVING APPLICATION"),1:"UNKNOWN"),MSG("DT/TM CREATED"),MSGIEN)=""
End DoDot:1
IF QUIT
QUIT
+26 IF MSGIEN>99999999999
SET MSGIEN=0
+27 SET ^HLTMP("LAST IEN CHECKED FOR MISSING APPLICATION ACK")=MSGIEN
+28 QUIT