VAQCON93 ;ALB/JRP - MESSAGE CONSTRUCTION;22-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
SEND10(TRANPTR) ;BUILD AND SEND A 1.0 MESSAGE
;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
;OUTPUT : 0 - Success
; -1^Error_Text - Error
;
;CHECK INPUT
Q:('(+$G(TRANPTR))) "-1^Did not pass pointer to VAQ - TRANSACTION file"
Q:('$D(^VAT(394.61,TRANPTR))) "-1^Did not pass a valid pointer to the VAQ - TRANSACTION file"
;DECLARE VARIABLES
N TMP,DOMAIN,XMZ,XMY,XMDUN,TYPE,LINE,SITE,STATUS,XMCHAN
S XMCHAN=1
;GET MESSAGE TYPE & STATUS
S TMP=$$STATYPE^VAQCON1(TRANPTR)
S STATUS=$P(TMP,"^",1)
Q:(STATUS="-1") "-1^Could not determine type of message to send"
S TYPE=$P(TMP,"^",2)
Q:((TYPE="RET")!(STATUS="VAQ-UNACK")) "-1^Equivalent message not available in version 1.0 format"
Q:((STATUS="VAQ-AUTO")!(STATUS="VAQ-PROC")!(STATUS="VAQ-TUNSL")) "-1^Message not required"
Q:(TYPE="REC") "-1^Transaction is being received, not transmitted"
;GET REMOTE DOMAIN
S DOMAIN=""
S:(TYPE="REQ") DOMAIN=$P($G(^VAT(394.61,TRANPTR,"ATHR2")),"^",2)
S:((TYPE="UNS")!(TYPE="RES")!(TYPE="ACK")) DOMAIN=$P($G(^VAT(394.61,TRANPTR,"RQST2")),"^",2)
Q:(DOMAIN="") "-1^Could not determine remote domain"
;GET LOCAL SITE
S TMP=+$O(^VAT(394.81,0))
S SITE=+$G(^VAT(394.81,TMP,0))
S TMP=$P($G(^DIC(4,SITE,0)),"^",1)
I (TMP="") S TMP=$P($$SITE^VASITE,"^",2) S:(TMP=-1) TMP="UNKNOWN"
S SITE=TMP
;MAKE STUB MESSAGE
S TMP="PDX (V1.0) TRANSMISSION FROM "_SITE
S XMZ=$$MAKESTUB^VAQCON1(TMP,"PDX")
Q:(XMZ<1) "-1^Could not create stub message"
;BUILD MESSAGE
S LINE=$$XMIT10^VAQCON94(TRANPTR,XMZ,"",1)
I (LINE<0) S TMP=$$KILLSTUB^VAQCON1(XMZ) Q LINE
;SET ZERO NODE
S TMP=$$SETZERO^VAQCON1(XMZ,LINE)
I (TMP<0) S LINE=$$KILLSTUB^VAQCON1(XMZ) Q TMP
;SEND MESSAGE
S TMP="S.VAQ-PDX-SERVER"_"@"_DOMAIN
S XMY(TMP)=""
S XMDUN="Patient Data eXchange"
D ENT1^XMD
Q 0
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQCON93 1915 printed Dec 13, 2024@02:24:51 Page 2
VAQCON93 ;ALB/JRP - MESSAGE CONSTRUCTION;22-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
SEND10(TRANPTR) ;BUILD AND SEND A 1.0 MESSAGE
+1 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
+2 ;OUTPUT : 0 - Success
+3 ; -1^Error_Text - Error
+4 ;
+5 ;CHECK INPUT
+6 if ('(+$GET(TRANPTR)))
QUIT "-1^Did not pass pointer to VAQ - TRANSACTION file"
+7 if ('$DATA(^VAT(394.61,TRANPTR)))
QUIT "-1^Did not pass a valid pointer to the VAQ - TRANSACTION file"
+8 ;DECLARE VARIABLES
+9 NEW TMP,DOMAIN,XMZ,XMY,XMDUN,TYPE,LINE,SITE,STATUS,XMCHAN
+10 SET XMCHAN=1
+11 ;GET MESSAGE TYPE & STATUS
+12 SET TMP=$$STATYPE^VAQCON1(TRANPTR)
+13 SET STATUS=$PIECE(TMP,"^",1)
+14 if (STATUS="-1")
QUIT "-1^Could not determine type of message to send"
+15 SET TYPE=$PIECE(TMP,"^",2)
+16 if ((TYPE="RET")!(STATUS="VAQ-UNACK"))
QUIT "-1^Equivalent message not available in version 1.0 format"
+17 if ((STATUS="VAQ-AUTO")!(STATUS="VAQ-PROC")!(STATUS="VAQ-TUNSL"))
QUIT "-1^Message not required"
+18 if (TYPE="REC")
QUIT "-1^Transaction is being received, not transmitted"
+19 ;GET REMOTE DOMAIN
+20 SET DOMAIN=""
+21 if (TYPE="REQ")
SET DOMAIN=$PIECE($GET(^VAT(394.61,TRANPTR,"ATHR2")),"^",2)
+22 if ((TYPE="UNS")!(TYPE="RES")!(TYPE="ACK"))
SET DOMAIN=$PIECE($GET(^VAT(394.61,TRANPTR,"RQST2")),"^",2)
+23 if (DOMAIN="")
QUIT "-1^Could not determine remote domain"
+24 ;GET LOCAL SITE
+25 SET TMP=+$ORDER(^VAT(394.81,0))
+26 SET SITE=+$GET(^VAT(394.81,TMP,0))
+27 SET TMP=$PIECE($GET(^DIC(4,SITE,0)),"^",1)
+28 IF (TMP="")
SET TMP=$PIECE($$SITE^VASITE,"^",2)
if (TMP=-1)
SET TMP="UNKNOWN"
+29 SET SITE=TMP
+30 ;MAKE STUB MESSAGE
+31 SET TMP="PDX (V1.0) TRANSMISSION FROM "_SITE
+32 SET XMZ=$$MAKESTUB^VAQCON1(TMP,"PDX")
+33 if (XMZ<1)
QUIT "-1^Could not create stub message"
+34 ;BUILD MESSAGE
+35 SET LINE=$$XMIT10^VAQCON94(TRANPTR,XMZ,"",1)
+36 IF (LINE<0)
SET TMP=$$KILLSTUB^VAQCON1(XMZ)
QUIT LINE
+37 ;SET ZERO NODE
+38 SET TMP=$$SETZERO^VAQCON1(XMZ,LINE)
+39 IF (TMP<0)
SET LINE=$$KILLSTUB^VAQCON1(XMZ)
QUIT TMP
+40 ;SEND MESSAGE
+41 SET TMP="S.VAQ-PDX-SERVER"_"@"_DOMAIN
+42 SET XMY(TMP)=""
+43 SET XMDUN="Patient Data eXchange"
+44 DO ENT1^XMD
+45 QUIT 0