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

HLUOPTF1.m

Go to the documentation of this file.
  1. HLUOPTF1 ;ALB/CJM-HL7 -Set Logic for the AI x-ref on file 773 ;02/04/2004
  1. ;;1.6;HEALTH LEVEL SEVEN;**109**;Oct 13, 1995
  1. ;
  1. PXREF(IEN,STATUS) ;sets the AI x-ref on file 773 and the FAST PURGE DT/TM fields in file 772 and 773
  1. ;Input: IEN is the ien of record in file 773
  1. ; STATUS is the new value of the STATUS field
  1. ;Output: none
  1. ;
  1. Q:'$G(IEN)
  1. ;
  1. ;don't set the x-ref if status is not Successfully Completed
  1. Q:($G(STATUS)'=3)
  1. ;
  1. N NODE,WHEN,CHILD
  1. ;
  1. ;also not if DON'T PURGE field is set
  1. Q:$P($G(^HLMA(IEN,2)),"^")=1
  1. ;
  1. ;also not if this isn't the initial message
  1. S NODE=$G(^HLMA(IEN,0))
  1. I $P(NODE,"^",6),$P(NODE,"^",6)'=IEN Q
  1. ;
  1. ;This record can be purged via FAST PURGE
  1. ;determine the dt/tm the record can be purged
  1. S WHEN=$$NOW^XLFDT
  1. S WHEN=$$FMADD^XLFDT(WHEN,$$WAIT)
  1. ;
  1. ;set the FAST PURGE DT/TM and x-ref, and do the same for file 772 record
  1. D SET(IEN,WHEN,+NODE)
  1. ;
  1. ;All the records in file 773 that point to this record (children) should be purged at the same time
  1. S CHILD=0
  1. F S CHILD=$O(^HLMA("AF",IEN,CHILD)) Q:'CHILD D:(CHILD'=IEN) SET(CHILD,WHEN,+$G(^HLMA(CHILD,0)))
  1. Q
  1. ;
  1. SET(IEN773,WHEN,IEN772) ;sets FAST PURGE DT/TM for and the AI x~ref for both file 772 & 773
  1. ;Input:
  1. ; IEN773 - ien of record to be purged in file 773
  1. ; WHEN - date/time to purge
  1. ; IEN772 - ien of corresponding record in file 772
  1. ;
  1. N OLDWHEN
  1. ;if the fast purge dt/tm changed, kill the old xref
  1. S OLDWHEN=$P($G(^HLMA(IEN773,2)),"^",2)
  1. I $L(OLDWHEN) K ^HLMA("AI",OLDWHEN,773,IEN773)
  1. ;
  1. ;set the FAST PURGE DATE
  1. S $P(^HLMA(IEN773,2),"^",2)=WHEN
  1. ;
  1. ;set the AI x-ref
  1. S ^HLMA("AI",WHEN,773,IEN773)=""
  1. ;
  1. ;do the same for the corresponding entry in file 772
  1. I IEN772,$D(^HL(772,IEN772,0)) D
  1. .;if the fast purge dt/tm changed, kill the old xref
  1. .S OLDWHEN=$P($G(^HL(772,IEN772,2)),"^",2)
  1. .I $L(OLDWHEN) K ^HLMA("AI",OLDWHEN,772,IEN772)
  1. .;set the FAST PURGE DATE
  1. .S $P(^HL(772,IEN772,2),"^",2)=WHEN
  1. .;
  1. .;set the AI x-ref
  1. .S ^HLMA("AI",WHEN,772,IEN772)=""
  1. Q
  1. ;
  1. WAIT() ;
  1. ;returns the wait time to purge completed messages from file 869.3
  1. N IEN
  1. S IEN=$O(^HLCS(869.3,0))
  1. Q:'IEN 0
  1. Q +$G(^HLCS(869.3,IEN,4))