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

HLCSTCP3.m

Go to the documentation of this file.
  1. HLCSTCP3 ;SFIRMFO/RSD - BI-DIRECTIONAL TCP ;09/13/2006
  1. ;;1.6;HEALTH LEVEL SEVEN;**76,77,133**;OCT 13, 1995;Build 13
  1. ;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. OPENA I $G(HLMSG),$D(^HLMA(HLMSG,"P")) S HLPORTA=+$P(^("P"),U,6)
  1. D MON^HLCSTCP("Open")
  1. S POP=1
  1. I $G(HLDIRECT("OPEN TIMEOUT")) D
  1. .S HLI=1
  1. .D CALL^%ZISTCP(HLTCPADD,HLTCPORT,HLDIRECT("OPEN TIMEOUT"))
  1. E D
  1. .F HLI=1:1:HLDRETR D CALL^%ZISTCP(HLTCPADD,HLTCPORT) Q:'POP
  1. ;set # of opens back in msg
  1. I $G(HLMSG),$D(^HLMA(HLMSG,"P")) S $P(^("P"),U,6)=HLPORTA+HLI
  1. ;device open
  1. I 'POP S HLPORT=IO D Q $S($G(HLERROR)]"":0,1:1)
  1. . N $ETRAP,$ESTACK S $ETRAP="D ERROR^HLCSTCP2" ;HL*1.6*77
  1. . ;if address came from DNS, set back into LL
  1. . I $D(HLIP) S $P(^HLCS(870,HLDP,400),U)=HLTCPADD
  1. . ; write and read to check if still open
  1. . Q:HLOS'["OpenM" X "U IO:(::""-M"")" ; must be Cache/NT + use packet mode
  1. . Q:$P(^HLCS(870,HLDP,400),U,7)'="Y" ; must want to SAY HELO
  1. . U IO W "HELO "_$$KSP^XUPARAM("WHERE"),! R X:1
  1. ;openfail-try DNS lookup
  1. I '$D(HLDOM) S HLDOM=+$P(^HLCS(870,HLDP,0),U,7),HLDOM=$P($G(^DIC(4.2,HLDOM,0)),U) D:HLDOM]"" DNS
  1. ;HLIP=ip add. from DNS call, get first one and try open again
  1. I $D(HLIP) S HLTCPADD=$P(HLIP,","),HLIP=$P(HLIP,",",2,99) G:HLTCPADD OPENA
  1. ;open error
  1. I $G(HLDIRECT("OPEN TIMEOUT")) D
  1. .D MON^HLCSTCP("Openfail")
  1. .I $D(HLPORT) D CLOSE^%ZISTCP K HLPORT
  1. E D
  1. .D CC^HLCSTCP2("Openfail") H 3
  1. Q 0
  1. ;
  1. ;following code was removed, site's complained of to many alerts
  1. ;couldn't open, send 1 alert
  1. ;I '$G(HLPORTA) D
  1. ;. ;send alert
  1. ;. N XQA,XQAMSG,XQAOPT,XQAROU,XQAID,Z
  1. ;. ;get mailgroup from file 869.3
  1. ;. S Z=$P($$PARAM^HLCS2,U,8),HLPORTA="" Q:Z=""
  1. ;. S XQA("G."_Z)="",XQAMSG=$$HTE^XLFDT($H,2)_" Logical Link "_$P(^HLCS(870,HLDP,0),U)_" exceeded Open Retries."
  1. ;. D SETUP^XQALERT
  1. ;open error
  1. ;D CC("Openfail") H 3
  1. ;Q 0
  1. ;
  1. ;
  1. DNS ;VA domains must have "med" inserted.
  1. ;All domains must use port 5000 and are prepended with "HL7"
  1. ;non-VA DNS lookups will succeed if site uses port 5000 and
  1. ;configure their local DNS with "HL7.yourdomain.com" and entries
  1. ;are created in the logical link file and domain file.
  1. D MON^HLCSTCP("DNS Lkup")
  1. I HLDOM["VA.GOV"&(HLDOM'[".MED.") S HLDOM=$P(HLDOM,".VA.GOV")_".MED.VA.GOV"
  1. I HLTCPORT=5000 S HLDOM="HL7."_HLDOM
  1. I HLTCPORT=5500 S HLDOM="MPI."_HLDOM
  1. S HLIP=$$ADDRESS^XLFNSLK(HLDOM)
  1. K:HLIP="" HLIP
  1. Q
  1. ;