HLCSGTM ;OIFO-O/RWF - (TCP/IP) GT.M Linux ;08/13/2007
;;1.6;HEALTH LEVEL SEVEN;**122**;Oct 13, 1995;Build 14
;Per VHA Directive 2004-038, this routine should not be modified.
;
; 1. port number is input from VMS COM file, such as HLSxxxxDSM.COM,
; HLSxxxxCACHE.COM, or HLSxxxxGTM.COM file, where xxxx is port
; number.
; 2. find the ien of #870(logical link file) for the multi-listener
Q
;
IEN(HLPORT) ;
; HLIEN870: ien in #870 (logical link file)
; HLPRTS: port number in entry to be tested
;
N HLPRTS,HLIEN870
I '$G(HLPORT) D ^%ZTER Q
S HLIEN870=0
F S HLIEN870=$O(^HLCS(870,"E","M",HLIEN870)) Q:'HLIEN870 D Q:(HLPRTS=HLPORT)
. S HLPRTS=$P(^HLCS(870,HLIEN870,400),"^",2)
I 'HLIEN870 D ^%ZTER Q
;
Q HLIEN870
;
GTMLNX ; From Linux xinetd script
;Get port from ZSHOW "D"
S U="^",$ZT="",$ET="D ^%ZTER HALT" ;Setup the error trap
; GTM specific code
S IO=$P X "U IO:(nowrap:nodelimiter:IOERROR=""TRAP"")" ;Setup device
S @("$ZINTERRUPT=""I $$JOBEXAM^ZU($ZPOSITION)""")
K ^TMP($J) ZSHOW "D":^TMP($J)
F %=1:1 Q:'$D(^TMP($J,"D",%)) S X=^(%) Q:X["LOCAL"
S IO("IP")=$P($P(X,"REMOTE=",2),"@"),IO("PORT")=+$P($P(X,"LOCAL=",2),"@",2)
S %=$P($ZTRNLNM("SSH_CLIENT")," ") S:%="" %=$ZTRNLNM("REMOTEHOST")
S HLDP=$$IEN(IO("PORT"))
;
D LISTEN^HLCSTCP
Q
;
;Sample Linux script
;#!/bin/bash
;#HL7 Listener
;cd /home/vista/dev/
;. ./gtmprofile
;#env > hl7log.txt
;$gtm_dist/mumps -r GTMLNX^HLCSGTM
;exit 0
;
;Sample xinetd config file
;service hl7tcp
;{
; socket_type = stream
; user = gtmuser
; wait = no
; disable = no
; server = /bin/bash
; server_args = -l /home/vista/dev/hl7tcp.sh
; passenv = REMOTE_HOST
;}
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HHLCSGTM 1821 printed Oct 16, 2024@17:57:19 Page 2
HLCSGTM ;OIFO-O/RWF - (TCP/IP) GT.M Linux ;08/13/2007
+1 ;;1.6;HEALTH LEVEL SEVEN;**122**;Oct 13, 1995;Build 14
+2 ;Per VHA Directive 2004-038, this routine should not be modified.
+3 ;
+4 ; 1. port number is input from VMS COM file, such as HLSxxxxDSM.COM,
+5 ; HLSxxxxCACHE.COM, or HLSxxxxGTM.COM file, where xxxx is port
+6 ; number.
+7 ; 2. find the ien of #870(logical link file) for the multi-listener
+8 QUIT
+9 ;
IEN(HLPORT) ;
+1 ; HLIEN870: ien in #870 (logical link file)
+2 ; HLPRTS: port number in entry to be tested
+3 ;
+4 NEW HLPRTS,HLIEN870
+5 IF '$GET(HLPORT)
DO ^%ZTER
QUIT
+6 SET HLIEN870=0
+7 FOR
SET HLIEN870=$ORDER(^HLCS(870,"E","M",HLIEN870))
if 'HLIEN870
QUIT
Begin DoDot:1
+8 SET HLPRTS=$PIECE(^HLCS(870,HLIEN870,400),"^",2)
End DoDot:1
if (HLPRTS=HLPORT)
QUIT
+9 IF 'HLIEN870
DO ^%ZTER
QUIT
+10 ;
+11 QUIT HLIEN870
+12 ;
GTMLNX ; From Linux xinetd script
+1 ;Get port from ZSHOW "D"
+2 ;Setup the error trap
SET U="^"
SET $ZT=""
SET $ETRAP="D ^%ZTER HALT"
+3 ; GTM specific code
+4 ;Setup device
SET IO=$PRINCIPAL
XECUTE "U IO:(nowrap:nodelimiter:IOERROR=""TRAP"")"
+5 SET @("$ZINTERRUPT=""I $$JOBEXAM^ZU($ZPOSITION)""")
+6 KILL ^TMP($JOB)