HLOAPI1 ;ALB/CJM-HL7 - Developer API's for sending & receiving messages(continued) ;02/04/2004
;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
;
SENDONE(HLMSTATE,PARMS,WHOTO,ERROR) ;
;Sends the message to a single receiving application.
;
;Input:
;HLMSTATE() - (pass by reference, required) This array is used by the HL7 package to track the progress of the message. The application MUST NOT touch it
;PARMS( *pass by reference*
; "APP ACK RESPONSE")=<tag^routine> to call when the app ack is received (optional)
; (NOTE: For batch messages, HLO best supports returning application
; acknowledgments via a batch response. However, non-VistA systems
; may return individual messages as application acknowledgments to
; messages within the original batch message, so for applications
; sending batch messages might best code the "APP ACK RESPONSE"
; routine to first check whether the response message is a batch.
;
; "ACCEPT ACK RESPONSE")=<tag^routine> to call when the commit ack is received (optional)
; "ACCEPT ACK TYPE") = <AL,NE> (optional, defaults to AL)
; "APP ACK TYPE") = <AL,NE> (optional, defaults to NE)
; "FAILURE RESPONSE" - <tag>^<routine> (optional) The sending application routine to execute when the transmission of the message fails, i.e., the message can not be sent or no commit ack is received.
; "QUEUE" - (optional) An application can name its own private queue - just a string up to 20 characters, it should be namespaced.
; "SECURITY")=security information to include in the header segment, SEQ 8 (optional)
; "SENDING APPLICATION")=name of sending app (required, 60 maximum length)
;
; WHOTO (required,pass by reference) an array specifying a single recipient. These subscripts are allowed:
;
; "RECEIVING APPLICATION" - (string, 60 char max, required)
;
; EXACTLY ONE of these parameters must be provided to identify the Receiving Facility:
;
; "FACILITY LINK IEN" - ien of the logical link
; "FACILITY LINK NAME" - name of the logical link
; "INSTITUTION IEN" - ptr to the INSTITUTION file
; "STATION NUMBER" - station # with suffix
;
; EXACTLY ONE of these MAY be provided - optionally - to identify the interface engine to route the message through:
;
; "IE LINK IEN" - ptr to a logical link for the interface engine
; "IE LINK NAME" - name of the logical link for the interface engine
;
;Output:
; Function returns the ien of the message in file 778 on success, 0 on failure
; HLMSTATE() - (pass by reference, required) This array is used by the HL7 package to track the progress of the message. The application MUST NOT touch it!
; ERROR (pass by reference, optional) - on failure, will contain an error message
; PARMS - left undefined when the function returns
; WHOTO - left undefined when the function returns
;
;
N SUCCESS S SUCCESS=0
D
.I '$G(HLMSTATE("BODY")),'$G(HLMSTATE("UNSTORED LINES")) S ERROR="MESSAGE NOT YET CREATED" Q
.;
.I $$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR),$$CHKWHO(.HLMSTATE,.WHOTO,.ERROR) D
..I $$SEND(.HLMSTATE,.ERROR) S SUCCESS=1
.E D DONTSEND(.HLMSTATE,$G(ERROR))
K PARMS,WHOTO
Q $S(SUCCESS:HLMSTATE("IEN"),1:0)
;
SENDMANY(HLMSTATE,PARMS,WHOTO) ;
;Sends the message to a list of receiving applications
;
;Input: Same as for $$SENDONE, except WHOTO is a list.
; WHOTO (pass by reference)
; Specifies a list of recipients. Each recipient should be on the
; list as WHOTO(i), where i=1,2,3,4, etc. for as many messages as to
; send. At each subscript WHOTO(i), the same lower level subscripts
; may be defined as in the $$SENDONE API. For example:
;
; WHOTO(1,"LINK NAME")="VAALB"
; WHOTO(1,"RECEIVING APPLICATION")="MPI"
; WHOTO(2,"STATION NUMBER")=500
; WHOTO(2,"RECEIVING APPLICATION")="MPI"
;
;
;Output:
; Function returns 1 if a message is queued to be sent to each intended recipient, 0 otherwise
; PARMS - left undefined when the function returns
; WHOTO (pass by reference) returns the status of each message to be sent in the format:
; (<i>,"QUEUED")= <1 if queued to be sent, 0 otherwise)
; (<i>,"IEN")=<ien, file 778>
; (<i>,"ERROR")= error message if an error was encountered (status=0), not defined otherwise
;
;
N ERROR,RETURN,WHO,STATE,I
S RETURN=1
I '$G(HLMSTATE("BODY")),'$G(HLMSTATE("UNSTORED LINES")) D K PARMS Q 0
.S ERROR="MESSAGE NOT YET CREATED"
.S I=0 F S I=$O(WHOTO(I)) Q:'I S WHOTO(I,"QUEUED")=0,WHOTO(I,"IEN")=0,WHOTO(I,"ERROR")=ERROR
;
I '$$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR) D K PARMS Q 0
.S I=0 F S I=$O(WHOTO(I)) Q:'I D
..K WHO M WHO=WHOTO(I)
..K STATE M STATE=HLMSTATE S STATE("IEN")=""
..S WHOTO(I,"QUEUED")=0
..D DONTSEND(.STATE,$G(ERROR))
..S WHOTO(I,"IEN")=$G(STATE("IEN"))
..S WHOTO(I,"ERROR")=ERROR
;
S I=0 F S I=$O(WHOTO(I)) Q:'I D
.K WHO M WHO=WHOTO(I)
.K STATE M STATE=HLMSTATE S STATE("IEN")=""
.S ERROR=""
.I $$CHKWHO(.STATE,.WHO,.ERROR) D
..I $$SEND(.STATE,.ERROR) D
...S WHOTO(I,"QUEUED")=1
...S WHOTO(I,"IEN")=STATE("IEN")
...S WHOTO(I,"ERROR")=""
..E D
...S WHOTO(I,"QUEUED")=0
...S WHOTO(I,"IEN")=$G(STATE("IEN"))
...S WHOTO(I,"ERROR")=$G(ERROR)
...S RETURN=0
.E D ;who not adequately determined
..S WHOTO(I,"QUEUED")=0,RETURN=0
..D DONTSEND(.STATE,$G(ERROR))
..S WHOTO(I,"IEN")=$G(STATE("IEN")),WHOTO(I,"ERROR")=$G(ERROR)
K PARMS
Q RETURN
;
SENDSUB(HLMSTATE,PARMS,MESSAGES) ;
;Sends the message to a list of receiving applications based on the HL7 Subscription Registry
;
;Input:
; HLMSTATE (pass by reference, required) same as $$SENDMANY
; PARMS (pass by reference, required) same as $$SENDMANY, with one additional subscript:
; "SUBSCRIPTION IEN" - the ien of an entry in the HL7 Subscription Registry, defining the intended recipients of this message
;
;Output:
; Function returns 1 if a message is queued to be sent to each intended recipient, 0 otherwise
; PARMS - left undefined when the function returns
; MESSAGES (pass by reference) returns the status of each message to be sent in this format, where subien is the ien of the recipient in the RECIPEINTS subfile of the HL7 Subscription Registry
; (<subien>,"QUEUED")= <1 if queued to be sent, 0 otherwise)
; (<subien>,"IEN")=<ien, file 778>
; (<subien>,"ERROR")= error message if an error was encountered (status=0), not defined otherwise
;
;
K MESSAGES
N ERROR,RETURN,STATE,SUBIEN,WHO
;
S RETURN=1
;
;
I '$G(HLMSTATE("BODY")),'$G(HLMSTATE("UNSTORED LINES")) S ERROR="MESSAGE NOT YET CREATED" K PARMS Q 0
I '$G(PARMS("SUBSCRIPTION IEN")) S ERROR="SUBSCRIPTION REGISTRY IEN NOT PROVIDED" K PARMS Q 0
;
I '$$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR) D K PARMS Q 0
.S SUBIEN=0 F S SUBIEN=$$NEXT^HLOASUB(PARMS("SUBSCRIPTION IEN"),.WHO) Q:'SUBIEN D
..N SARY,HARY
..S HARY="STATE(""HDR"")"
..S SARY="STATE(""STATUS"")"
..K STATE M STATE=HLMSTATE S STATE("IEN")=""
..;move parameters into HLMSTATE
..S @SARY@("LINK IEN")=WHO("LINK IEN")
..S @SARY@("LINK NAME")=WHO("LINK NAME")
..S @HARY@("RECEIVING APPLICATION")=WHO("RECEIVING APPLICATION")
..M @HARY@("RECEIVING FACILITY")=WHO("RECEIVING FACILITY")
..D DONTSEND(.STATE,$G(ERROR))
..S MESSAGES(SUBIEN,"QUEUED")=0
..S MESSAGES(SUBIEN,"IEN")=$G(STATE("IEN"))
..S MESSAGES(SUBIEN,"ERROR")=$G(ERROR)
;
F S SUBIEN=$$NEXT^HLOASUB(PARMS("SUBSCRIPTION IEN"),.WHO) Q:'SUBIEN D
.N SARY,HARY
.S HARY="STATE(""HDR"")"
.S SARY="STATE(""STATUS"")"
.K STATE M STATE=HLMSTATE S STATE("IEN")=""
.;move parameters into HLMSTATE
.S @SARY@("LINK IEN")=WHO("LINK IEN")
.S @SARY@("LINK NAME")=WHO("LINK NAME")
.S @HARY@("RECEIVING APPLICATION")=WHO("RECEIVING APPLICATION")
.M @HARY@("RECEIVING FACILITY")=WHO("RECEIVING FACILITY")
.S ERROR=""
.I $$SEND(.STATE,.ERROR) D
..S MESSAGES(SUBIEN,"QUEUED")=1
.E D
..S MESSAGES(SUBIEN,"QUEUED")=0,RETURN=0
.S MESSAGES(SUBIEN,"IEN")=$G(STATE("IEN")),MESSAGES(SUBIEN,"ERROR")=$G(ERROR)
K PARMS
Q RETURN
;
SEND(HLMSTATE,ERROR) ;
;
K ERROR
I HLMSTATE("UNSTORED LINES"),'$$SAVEMSG^HLOF777(.HLMSTATE) S ERROR="$$SAVE^HLOF777 FAILED!" Q 0
;
I '$$SAVEMSG^HLOF778(.HLMSTATE) S ERROR="$$SAVE^HLOF778 FAILED!" Q 0
D OUTQUE^HLOQUE(HLMSTATE("STATUS","LINK NAME"),$G(HLMSTATE("STATUS","PORT")),HLMSTATE("STATUS","QUEUE"),HLMSTATE("IEN"))
Q HLMSTATE("IEN")
;
DONTSEND(HLMSTATE,ERROR) ;
;This procedure does NOT send a message. Rather, it creates an entry in file 778 with the
;of "SE".
;Input:
; HLMSTATE - pass-by-reference
; ERROR (optional, pass-by-value) error text to store with the message
;Output: none
;
I HLMSTATE("UNSTORED LINES"),'$$SAVEMSG^HLOF777(.HLMSTATE) ; just continue
;
S HLMSTATE("STATUS")="SE"
S HLSTATE("STATUS","PURGE")=$$FMADD^XLFDT(HLMSTATE("DT/TM CREATED"),HLMSTATE("SYSTEM","ERROR PURGE"))
S HLMSTATE("STATUS","ERROR TEXT")=$G(ERROR)
I '$$SAVEMSG^HLOF778(.HLMSTATE) ;already reported an error to the app
Q
;
CHKWHO(HLMSTATE,WHOTO,ERROR) ;
N RETURN,I
S ERROR=""
S RETURN=1
I '$$CHECKWHO^HLOASUB1(.WHOTO,.RETURN,.ERROR) S RETURN=0
;
;move parameters into HLMSTATE
S HLMSTATE("STATUS","LINK IEN")=$G(RETURN("LINK IEN"))
S HLMSTATE("STATUS","LINK NAME")=$G(RETURN("LINK NAME"))
S HLMSTATE("STATUS","PORT")=$P($G(RETURN("RECEIVING FACILITY",2)),":",2)
S HLMSTATE("HDR","RECEIVING APPLICATION")=$G(RETURN("RECEIVING APPLICATION"))
F I=1:1:3 S HLMSTATE("HDR","RECEIVING FACILITY",I)=$G(RETURN("RECEIVING FACILITY",I))
Q RETURN
HLOAPI1 ;ALB/CJM-HL7 - Developer API's for sending & receiving messages(continued) ;02/04/2004
+1 ;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
+2 ;
SENDONE(HLMSTATE,PARMS,WHOTO,ERROR) ;
+1 ;Sends the message to a single receiving application.
+2 ;
+3 ;Input:
+4 ;HLMSTATE() - (pass by reference, required) This array is used by the HL7 package to track the progress of the message. The application MUST NOT touch it
+5 ;PARMS( *pass by reference*
+6 ; "APP ACK RESPONSE")=<tag^routine> to call when the app ack is received (optional)
+7 ; (NOTE: For batch messages, HLO best supports returning application
+8 ; acknowledgments via a batch response. However, non-VistA systems
+9 ; may return individual messages as application acknowledgments to
+10 ; messages within the original batch message, so for applications
+11 ; sending batch messages might best code the "APP ACK RESPONSE"
+12 ; routine to first check whether the response message is a batch.
+13 ;
+14 ; "ACCEPT ACK RESPONSE")=<tag^routine> to call when the commit ack is received (optional)
+15 ; "ACCEPT ACK TYPE") = <AL,NE> (optional, defaults to AL)
+16 ; "APP ACK TYPE") = <AL,NE> (optional, defaults to NE)
+17 ; "FAILURE RESPONSE" - <tag>^<routine> (optional) The sending application routine to execute when the transmission of the message fails, i.e., the message can not be sent or no commit ack is received.
+18 ; "QUEUE" - (optional) An application can name its own private queue - just a string up to 20 characters, it should be namespaced.
+19 ; "SECURITY")=security information to include in the header segment, SEQ 8 (optional)
+20 ; "SENDING APPLICATION")=name of sending app (required, 60 maximum length)
+21 ;
+22 ; WHOTO (required,pass by reference) an array specifying a single recipient. These subscripts are allowed:
+23 ;
+24 ; "RECEIVING APPLICATION" - (string, 60 char max, required)
+25 ;
+26 ; EXACTLY ONE of these parameters must be provided to identify the Receiving Facility:
+27 ;
+28 ; "FACILITY LINK IEN" - ien of the logical link
+29 ; "FACILITY LINK NAME" - name of the logical link
+30 ; "INSTITUTION IEN" - ptr to the INSTITUTION file
+31 ; "STATION NUMBER" - station # with suffix
+32 ;
+33 ; EXACTLY ONE of these MAY be provided - optionally - to identify the interface engine to route the message through:
+34 ;
+35 ; "IE LINK IEN" - ptr to a logical link for the interface engine
+36 ; "IE LINK NAME" - name of the logical link for the interface engine
+37 ;
+38 ;Output:
+39 ; Function returns the ien of the message in file 778 on success, 0 on failure
+40 ; HLMSTATE() - (pass by reference, required) This array is used by the HL7 package to track the progress of the message. The application MUST NOT touch it!
+41 ; ERROR (pass by reference, optional) - on failure, will contain an error message
+42 ; PARMS - left undefined when the function returns
+43 ; WHOTO - left undefined when the function returns
+44 ;
+45 ;
+46 NEW SUCCESS
SET SUCCESS=0
+47 Begin DoDot:1
+48 IF '$GET(HLMSTATE("BODY"))
IF '$GET(HLMSTATE("UNSTORED LINES"))
SET ERROR="MESSAGE NOT YET CREATED"
QUIT
+49 ;
+50 IF $$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR)
IF $$CHKWHO(.HLMSTATE,.WHOTO,.ERROR)
Begin DoDot:2
+51 IF $$SEND(.HLMSTATE,.ERROR)
SET SUCCESS=1
End DoDot:2
+52 IF '$TEST
DO DONTSEND(.HLMSTATE,$GET(ERROR))
End DoDot:1
+53 KILL PARMS,WHOTO
+54 QUIT $SELECT(SUCCESS:HLMSTATE("IEN"),1:0)
+55 ;
SENDMANY(HLMSTATE,PARMS,WHOTO) ;
+1 ;Sends the message to a list of receiving applications
+2 ;
+3 ;Input: Same as for $$SENDONE, except WHOTO is a list.
+4 ; WHOTO (pass by reference)
+5 ; Specifies a list of recipients. Each recipient should be on the
+6 ; list as WHOTO(i), where i=1,2,3,4, etc. for as many messages as to
+7 ; send. At each subscript WHOTO(i), the same lower level subscripts
+8 ; may be defined as in the $$SENDONE API. For example:
+9 ;
+10 ; WHOTO(1,"LINK NAME")="VAALB"
+11 ; WHOTO(1,"RECEIVING APPLICATION")="MPI"
+12 ; WHOTO(2,"STATION NUMBER")=500
+13 ; WHOTO(2,"RECEIVING APPLICATION")="MPI"
+14 ;
+15 ;
+16 ;Output:
+17 ; Function returns 1 if a message is queued to be sent to each intended recipient, 0 otherwise
+18 ; PARMS - left undefined when the function returns
+19 ; WHOTO (pass by reference) returns the status of each message to be sent in the format:
+20 ; (<i>,"QUEUED")= <1 if queued to be sent, 0 otherwise)
+21 ; (<i>,"IEN")=<ien, file 778>
+22 ; (<i>,"ERROR")= error message if an error was encountered (status=0), not defined otherwise
+23 ;
+24 ;
+25 NEW ERROR,RETURN,WHO,STATE,I
+26 SET RETURN=1
+27 IF '$GET(HLMSTATE("BODY"))
IF '$GET(HLMSTATE("UNSTORED LINES"))
Begin DoDot:1
+28 SET ERROR="MESSAGE NOT YET CREATED"
+29 SET I=0
FOR
SET I=$ORDER(WHOTO(I))
IF 'I
QUIT
SET WHOTO(I,"QUEUED")=0
SET WHOTO(I,"IEN")=0
SET WHOTO(I,"ERROR")=ERROR
End DoDot:1
KILL PARMS
QUIT 0
+30 ;
+31 IF '$$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR)
Begin DoDot:1
+32 SET I=0
FOR
SET I=$ORDER(WHOTO(I))
IF 'I
QUIT
Begin DoDot:2
+33 KILL WHO
MERGE WHO=WHOTO(I)
+34 KILL STATE
MERGE STATE=HLMSTATE
SET STATE("IEN")=""
+35 SET WHOTO(I,"QUEUED")=0
+36 DO DONTSEND(.STATE,$GET(ERROR))
+37 SET WHOTO(I,"IEN")=$GET(STATE("IEN"))
+38 SET WHOTO(I,"ERROR")=ERROR
End DoDot:2
End DoDot:1
KILL PARMS
QUIT 0
+39 ;
+40 SET I=0
FOR
SET I=$ORDER(WHOTO(I))
IF 'I
QUIT
Begin DoDot:1
+41 KILL WHO
MERGE WHO=WHOTO(I)
+42 KILL STATE
MERGE STATE=HLMSTATE
SET STATE("IEN")=""
+43 SET ERROR=""
+44 IF $$CHKWHO(.STATE,.WHO,.ERROR)
Begin DoDot:2
+45 IF $$SEND(.STATE,.ERROR)
Begin DoDot:3
+46 SET WHOTO(I,"QUEUED")=1
+47 SET WHOTO(I,"IEN")=STATE("IEN")
+48 SET WHOTO(I,"ERROR")=""
End DoDot:3
+49 IF '$TEST
Begin DoDot:3
+50 SET WHOTO(I,"QUEUED")=0
+51 SET WHOTO(I,"IEN")=$GET(STATE("IEN"))
+52 SET WHOTO(I,"ERROR")=$GET(ERROR)
+53 SET RETURN=0
End DoDot:3
End DoDot:2
+54 ;who not adequately determined
IF '$TEST
Begin DoDot:2
+55 SET WHOTO(I,"QUEUED")=0
SET RETURN=0
+56 DO DONTSEND(.STATE,$GET(ERROR))
+57 SET WHOTO(I,"IEN")=$GET(STATE("IEN"))
SET WHOTO(I,"ERROR")=$GET(ERROR)
End DoDot:2
End DoDot:1
+58 KILL PARMS
+59 QUIT RETURN
+60 ;
SENDSUB(HLMSTATE,PARMS,MESSAGES) ;
+1 ;Sends the message to a list of receiving applications based on the HL7 Subscription Registry
+2 ;
+3 ;Input:
+4 ; HLMSTATE (pass by reference, required) same as $$SENDMANY
+5 ; PARMS (pass by reference, required) same as $$SENDMANY, with one additional subscript:
+6 ; "SUBSCRIPTION IEN" - the ien of an entry in the HL7 Subscription Registry, defining the intended recipients of this message
+7 ;
+8 ;Output:
+9 ; Function returns 1 if a message is queued to be sent to each intended recipient, 0 otherwise
+10 ; PARMS - left undefined when the function returns
+11 ; MESSAGES (pass by reference) returns the status of each message to be sent in this format, where subien is the ien of the recipient in the RECIPEINTS subfile of the HL7 Subscription Registry
+12 ; (<subien>,"QUEUED")= <1 if queued to be sent, 0 otherwise)
+13 ; (<subien>,"IEN")=<ien, file 778>
+14 ; (<subien>,"ERROR")= error message if an error was encountered (status=0), not defined otherwise
+15 ;
+16 ;
+17 KILL MESSAGES
+18 NEW ERROR,RETURN,STATE,SUBIEN,WHO
+19 ;
+20 SET RETURN=1
+21 ;
+22 ;
+23 IF '$GET(HLMSTATE("BODY"))
IF '$GET(HLMSTATE("UNSTORED LINES"))
SET ERROR="MESSAGE NOT YET CREATED"
KILL PARMS
QUIT 0
+24 IF '$GET(PARMS("SUBSCRIPTION IEN"))
SET ERROR="SUBSCRIPTION REGISTRY IEN NOT PROVIDED"
KILL PARMS
QUIT 0
+25 ;
+26 IF '$$CHKPARMS^HLOAPI2(.HLMSTATE,.PARMS,.ERROR)
Begin DoDot:1
+27 SET SUBIEN=0
FOR
SET SUBIEN=$$NEXT^HLOASUB(PARMS("SUBSCRIPTION IEN"),.WHO)
IF 'SUBIEN
QUIT
Begin DoDot:2
+28 NEW SARY,HARY
+29 SET HARY="STATE(""HDR"")"
+30 SET SARY="STATE(""STATUS"")"
+31 KILL STATE
MERGE STATE=HLMSTATE
SET STATE("IEN")=""
+32 ;move parameters into HLMSTATE
+33 SET @SARY@("LINK IEN")=WHO("LINK IEN")
+34 SET @SARY@("LINK NAME")=WHO("LINK NAME")
+35 SET @HARY@("RECEIVING APPLICATION")=WHO("RECEIVING APPLICATION")
+36 MERGE @HARY@("RECEIVING FACILITY")=WHO("RECEIVING FACILITY")
+37 DO DONTSEND(.STATE,$GET(ERROR))
+38 SET MESSAGES(SUBIEN,"QUEUED")=0
+39 SET MESSAGES(SUBIEN,"IEN")=$GET(STATE("IEN"))
+40 SET MESSAGES(SUBIEN,"ERROR")=$GET(ERROR)
End DoDot:2
End DoDot:1
KILL PARMS
QUIT 0
+41 ;
+42 FOR
SET SUBIEN=$$NEXT^HLOASUB(PARMS("SUBSCRIPTION IEN"),.WHO)
IF 'SUBIEN
QUIT
Begin DoDot:1
+43 NEW SARY,HARY
+44 SET HARY="STATE(""HDR"")"
+45 SET SARY="STATE(""STATUS"")"
+46 KILL STATE
MERGE STATE=HLMSTATE
SET STATE("IEN")=""
+47 ;move parameters into HLMSTATE
+48 SET @SARY@("LINK IEN")=WHO("LINK IEN")
+49 SET @SARY@("LINK NAME")=WHO("LINK NAME")
+50 SET @HARY@("RECEIVING APPLICATION")=WHO("RECEIVING APPLICATION")
+51 MERGE @HARY@("RECEIVING FACILITY")=WHO("RECEIVING FACILITY")
+52 SET ERROR=""
+53 IF $$SEND(.STATE,.ERROR)
Begin DoDot:2
+54 SET MESSAGES(SUBIEN,"QUEUED")=1
End DoDot:2
+55 IF '$TEST
Begin DoDot:2
+56 SET MESSAGES(SUBIEN,"QUEUED")=0
SET RETURN=0
End DoDot:2
+57 SET MESSAGES(SUBIEN,"IEN")=$GET(STATE("IEN"))
SET MESSAGES(SUBIEN,"ERROR")=$GET(ERROR)
End DoDot:1
+58 KILL PARMS
+59 QUIT RETURN
+60 ;
SEND(HLMSTATE,ERROR) ;
+1 ;
+2 KILL ERROR
+3 IF HLMSTATE("UNSTORED LINES")
IF '$$SAVEMSG^HLOF777(.HLMSTATE)
SET ERROR="$$SAVE^HLOF777 FAILED!"
QUIT 0
+4 ;
+5 IF '$$SAVEMSG^HLOF778(.HLMSTATE)
SET ERROR="$$SAVE^HLOF778 FAILED!"
QUIT 0
+6 DO OUTQUE^HLOQUE(HLMSTATE("STATUS","LINK NAME"),$GET(HLMSTATE("STATUS","PORT")),HLMSTATE("STATUS","QUEUE"),HLMSTATE("IEN"))
+7 QUIT HLMSTATE("IEN")
+8 ;
DONTSEND(HLMSTATE,ERROR) ;
+1 ;This procedure does NOT send a message. Rather, it creates an entry in file 778 with the
+2 ;of "SE".
+3 ;Input:
+4 ; HLMSTATE - pass-by-reference
+5 ; ERROR (optional, pass-by-value) error text to store with the message
+6 ;Output: none
+7 ;
+8 ; just continue
IF HLMSTATE("UNSTORED LINES")
IF '$$SAVEMSG^HLOF777(.HLMSTATE)
+9 ;
+10 SET HLMSTATE("STATUS")="SE"
+11 SET HLSTATE("STATUS","PURGE")=$$FMADD^XLFDT(HLMSTATE("DT/TM CREATED"),HLMSTATE("SYSTEM","ERROR PURGE"))
+12 SET HLMSTATE("STATUS","ERROR TEXT")=$GET(ERROR)
+13 ;already reported an error to the app
IF '$$SAVEMSG^HLOF778(.HLMSTATE)
+14 QUIT
+15 ;
CHKWHO(HLMSTATE,WHOTO,ERROR) ;
+1 NEW RETURN,I
+2 SET ERROR=""
+3 SET RETURN=1
+4 IF '$$CHECKWHO^HLOASUB1(.WHOTO,.RETURN,.ERROR)
SET RETURN=0
+5 ;
+6 ;move parameters into HLMSTATE
+7 SET HLMSTATE("STATUS","LINK IEN")=$GET(RETURN("LINK IEN"))
+8 SET HLMSTATE("STATUS","LINK NAME")=$GET(RETURN("LINK NAME"))
+9 SET HLMSTATE("STATUS","PORT")=$PIECE($GET(RETURN("RECEIVING FACILITY",2)),":",2)
+10 SET HLMSTATE("HDR","RECEIVING APPLICATION")=$GET(RETURN("RECEIVING APPLICATION"))
+11 FOR I=1:1:3
SET HLMSTATE("HDR","RECEIVING FACILITY",I)=$GET(RETURN("RECEIVING FACILITY",I))
+12 QUIT RETURN