~jontai/openvista-gtm-integration/bug672798

« back to all changes in this revision

Viewing changes to mumps/HLCSTCP3.m

  • Committer: Jonathan Tai
  • Date: 2010-03-05 07:39:08 UTC
  • mfrom: (123.1.3 bug532393)
  • Revision ID: jon.tai@medsphere.com-20100305073908-p4zzra1m2oitvqqh
Merge bug 532393 - Turn I/O error trapping on in HL7 code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
HLCSTCP3 ;SFIRMFO/RSD MSC/JKT - BI-DIRECTIONAL TCP ;02/25/2010  11:08
 
2
 ;;1.6;HEALTH LEVEL SEVEN;**76,77,MSC**;JUL 17, 1995
 
3
 ;
 
4
OPENA I $G(HLMSG),$D(^HLMA(HLMSG,"P")) S HLPORTA=+$P(^("P"),U,6)
 
5
 D MON^HLCSTCP("Open")
 
6
 S POP=1
 
7
 F HLI=1:1:HLDRETR D CALL^%ZISTCP(HLTCPADD,HLTCPORT) Q:'POP
 
8
 ;set # of opens back in msg
 
9
 I $G(HLMSG),$D(^HLMA(HLMSG,"P")) S $P(^("P"),U,6)=HLPORTA+HLI
 
10
 ;device open
 
11
 I 'POP S HLPORT=IO D  Q $S($G(HLERROR)]"":0,1:1)
 
12
 . N $ETRAP,$ESTACK S $ETRAP="D ERROR^HLCSTCP2" ;HL*1.6*77
 
13
 . I HLOS["GT.M" X "U IO:(IOERROR=""TRAP"":EXCEPT=""G ERROR^HLCSTCP2"")" ;turn on error trapping on GT.M
 
14
 . ;if address came from DNS, set back into LL
 
15
 . I $D(HLIP) S $P(^HLCS(870,HLDP,400),U)=HLTCPADD
 
16
 . ; write and read to check if still open
 
17
 . Q:HLOS'["OpenM"  X "U IO:(::""-M"")" ; must be Cache/NT + use packet mode
 
18
 . Q:$P(^HLCS(870,HLDP,400),U,7)'="Y"  ; must want to SAY HELO
 
19
 . U IO W "HELO "_$$KSP^XUPARAM("WHERE"),! R X:1
 
20
 ;openfail-try DNS lookup
 
21
 I '$D(HLDOM) S HLDOM=+$P(^HLCS(870,HLDP,0),U,7),HLDOM=$P($G(^DIC(4.2,HLDOM,0)),U) D:HLDOM]"" DNS
 
22
 ;HLIP=ip add. from DNS call, get first one and try open again
 
23
 I $D(HLIP) S HLTCPADD=$P(HLIP,","),HLIP=$P(HLIP,",",2,99) G:HLTCPADD OPENA
 
24
 ;open error
 
25
 D CC^HLCSTCP2("Openfail") H 3
 
26
 Q 0
 
27
 ;
 
28
 ;following code was removed, site's complained of to many alerts
 
29
 ;couldn't open, send 1 alert
 
30
 ;I '$G(HLPORTA) D
 
31
 ;. ;send alert
 
32
 ;. N XQA,XQAMSG,XQAOPT,XQAROU,XQAID,Z
 
33
 ;. ;get mailgroup from file 869.3
 
34
 ;. S Z=$P($$PARAM^HLCS2,U,8),HLPORTA="" Q:Z=""
 
35
 ;. S XQA("G."_Z)="",XQAMSG=$$HTE^XLFDT($H,2)_" Logical Link "_$P(^HLCS(870,HLDP,0),U)_" exceeded Open Retries."
 
36
 ;. D SETUP^XQALERT
 
37
 ;open error
 
38
 ;D CC("Openfail") H 3
 
39
 ;Q 0
 
40
 ;
 
41
 ;
 
42
DNS ;VA domains must have "med" inserted.
 
43
 ;All domains must use port 5000 and are prepended with "HL7"
 
44
 ;non-VA DNS lookups will succeed if site uses port 5000 and 
 
45
 ;configure their local DNS with "HL7.yourdomain.com" and entries
 
46
 ;are created in the logical link file and domain file.
 
47
 D MON^HLCSTCP("DNS Lkup")
 
48
 I HLDOM["VA.GOV"&(HLDOM'[".MED.") S HLDOM=$P(HLDOM,".VA.GOV")_".MED.VA.GOV"
 
49
 I HLTCPORT=5000 S HLDOM="HL7."_HLDOM
 
50
 I HLTCPORT=5500 S HLDOM="MPI."_HLDOM
 
51
 S HLIP=$$ADDRESS^XLFNSLK(HLDOM)
 
52
 K:HLIP="" HLIP
 
53
 Q
 
54
 ;