VistA-FOIAVistA/r/HEALTH_LEVEL_SEVEN-HL/HLOSRVR2.m

51 lines
1.7 KiB
Mathematica
Raw Normal View History

HLOSRVR2 ;ALB/CJM-HL7 - HLO Server ;07/20/2007
;;1.6;HEALTH LEVEL SEVEN;**131,137**;Oct 13, 1995;Build 21
;Per VHA Directive 2004-038, this routine should not be modified.
;
NEWMSG(HLCSTATE,HLMSTATE,HDR) ;
;initialize the HLMSTATE array after reading the header
;Inputs:
; HLCSTATE (pass by reference)
; HDR (pass by reference) parsed header
;Output:
; HLMSTATE (pass by reference)
;
K HLMSTATE
S HLMSTATE("IEN")=""
S HLMSTATE("BODY")=""
S HLMSTATE("DIRECTION")="IN"
S HLMSTATE("CURRENT SEGMENT")=0 ;no segments in cache
S HLMSTATE("UNSTORED LINES")=1 ;just the header in cache so far
S HLMSTATE("LINE COUNT")=0 ;no lines within message stored to disk
I HDR("SEGMENT TYPE")="BHS" D
.S HLMSTATE("BATCH")=1
.S HLMSTATE("ID")=HDR("BATCH CONTROL ID")
.S HLMSTATE("BATCH","CURRENT MESSAGE")=0 ;no messages in batch
.S HLMSTATE("UNSTORED MSH")=0
E D
.S HLMSTATE("BATCH")=0
.S HLMSTATE("ID")=HDR("MESSAGE CONTROL ID")
M HLMSTATE("HDR")=HDR
M HLMSTATE("SYSTEM")=HLCSTATE("SYSTEM")
S HLMSTATE("STATUS")=""
S HLMSTATE("STATUS","QUEUE")=""
S HLMSTATE("STATUS","ACTION")=""
S HLMSTATE("STATUS","LINK NAME")=HLCSTATE("LINK","NAME")
S HLMSTATE("STATUS","PORT")=$P(HDR("SENDING FACILITY",2),":",2)
;
;if this is a batch, and it references another batch, assume it is a b.
I HLMSTATE("BATCH"),HLMSTATE("ID")]"" D
.N IEN
.S HLMSTATE("ACK TO")=HLMSTATE("ID")
.S HLMSTATE("ACK TO","STATUS")="SU"
.S IEN=$O(^HLB("B",HLMSTATE("ID"),0))
.I IEN S HLMSTATE("ACK TO","IEN")=IEN_"^"
E S HLMSTATE("ACK TO")=""
I 'HLMSTATE("BATCH"),HDR("ACCEPT ACK TYPE")="",HDR("APP ACK TYPE")="" D
.S HLMSTATE("ORIGINAL MODE")=1
E D
.S HLMSTATE("ORIGINAL MODE")=0
N I F I=1,3 S HLMSTATE("MSA",I)=""
S HLMSTATE("MSA",2)=HLMSTATE("ID")
Q