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

HLOAPP.m

Go to the documentation of this file.
  1. HLOAPP ;ALB/CJM-HL7 -Application Registry ;02/04/2004
  1. ;;1.6;HEALTH LEVEL SEVEN;**126**;Oct 13, 1995
  1. ;
  1. GETIEN(NAME) ;given the application name, it finds the ien. Returns 0 on failure
  1. Q:'$L($G(NAME)) 0
  1. N IEN,SUB
  1. S SUB=$E(NAME,1,60)
  1. S IEN=0
  1. F S IEN=$O(^HLD(779.2,"B",SUB,IEN)) Q:'IEN Q:$P($G(^HLD(779.2,IEN,0)),"^")=NAME
  1. Q +IEN
  1. ;
  1. ACTION(HEADER,ACTION,QUEUE) ;Given the parsed header of a message it returns both the action that should be performed in response to the message and the incoming queue that it should be placed on.
  1. ;
  1. ;Input:
  1. ; HEADER() subscripts are used: "RECEIVING APPLICATION","SEGMENT TYPE", "MESSAGE TYPE", "EVENT"
  1. ;Output:
  1. ; Function returns 1 on success, 0 on failure
  1. ; ACTION (pass by reference) <tag>^<rtn>
  1. ; QUEUE (pass by reference) returns the named queue if there is one, else "DEFAULT"
  1. ;
  1. N IEN
  1. S (ACTION,QUEUE)=""
  1. S IEN=$$GETIEN(HEADER("RECEIVING APPLICATION"))
  1. Q:'$G(IEN) 0
  1. I $G(HEADER("SEGMENT TYPE"))="BHS" D
  1. .S NODE=$G(^HLD(779.2,IEN,0))
  1. .I $P(NODE,"^",5)]"" D
  1. ..S ACTION=$P(NODE,"^",4,5)
  1. .E I $P(NODE,"^",7)]"" S ACTION=$P(NODE,"^",6,7)
  1. .I $P(NODE,"^",8)]"" D
  1. ..S QUEUE=$P(NODE,"^",8)
  1. .E I $P(NODE,"^",3)]"" S QUEUE=$P(NODE,"^",3)
  1. E I HEADER("SEGMENT TYPE")="MSH" D
  1. .I HEADER("MESSAGE TYPE")'="",HEADER("EVENT")'="" D
  1. ..N SUBIEN,NODE
  1. ..S SUBIEN=$O(^HLD(779.2,IEN,1,"C",HEADER("MESSAGE TYPE"),HEADER("EVENT"),0))
  1. ..I SUBIEN D
  1. ...S NODE=$G(^HLD(779.2,IEN,1,SUBIEN,0))
  1. ...I $P(NODE,"^",5)]"" S ACTION=$P(NODE,"^",4,5)
  1. ...I $P(NODE,"^",3)]"" S QUEUE=$P(NODE,"^",3)
  1. ..I ACTION="" S NODE=$G(^HLD(779.2,IEN,0)) I $P(NODE,"^",7)]"" S ACTION=$P(NODE,"^",6,7)
  1. ..I QUEUE="" S NODE=$G(^HLD(779.2,IEN,0)) I $P(NODE,"^",3)]"" S QUEUE=$P(NODE,"^",3)
  1. I QUEUE="" S QUEUE="DEFAULT"
  1. I ACTION="" Q 0
  1. Q 1
  1. ;
  1. RTRNLNK(APPNAME) ;
  1. ;given the name of a receiving application, this returns the return
  1. ;link for application acks if one is provided. Otherwise, return
  1. ;acks are routed based on the information provide in the message hdr
  1. ;
  1. Q:(APPNAME="") ""
  1. N IEN
  1. S IEN=$$GETIEN(APPNAME)
  1. Q:IEN $P($G(^HLD(779.2,IEN,0)),"^",2)
  1. Q ""
  1. ;
  1. RTRNPORT(APPNAME) ;
  1. ;Given the name of the sending application, IF the application has its
  1. ;own listener, its port # is returned. Application acks should be
  1. ;returned using that port
  1. Q:(APPNAME="") ""
  1. N IEN,LINK
  1. S IEN=$$GETIEN(APPNAME)
  1. Q:'IEN ""
  1. S LINK=$P($G(^HLD(779.2,IEN,0)),"^",9)
  1. Q:'LINK ""
  1. Q $$PORT^HLOTLNK(LINK)