VAQCON ;ALB/JRP - MESSAGE CONSTRUCTION;14-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
XMIT(TRANARR,ROOT,MESSNUM,ARRAY,OFFSET) ;BUILD MESSAGE FOR TRANSACTION
;INPUT : TRANARR - Array whose subscripts are pointers to
; VAQ - TRANSACTION file (full global reference)
; ROOT - Location of Extraction Arrays (full global reference)
; MESSNUM - Message number to place transmisison into
; (if 0, transmission will be placed in ARRAY)
; ARRAY - Array to store transmission in (full global reference)
; OFFSET - Where to begin placing information (defaults to 0)
;OUTPUT : N - Number of lines in transmission
; -1^Error_Text - Error
;NOTES : Transactions pointed to by TRANARR will be placed in the
; same transmission and therefore should have the same domain
; as their destination.
; : If MESSNUM=0, then the transmission will be placed into
; ARRAY(LineNumber)=Line_of_info
; If MESSNUM>0 then the transmission will be placed into
; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
; : The first subscript in ROOT must be a pointer to the
; transaction. The second subscript in ROOT must be the
; segment abbreviation. This is required to identify the
; segments for each transaction contained in a DATA or DISPLAY
; block. ( ROOT(TransactionPointer,SegmentAbbreviation) )
;
;CHECK INPUT
Q:($G(TRANARR)="") "-1^Did not pass reference to array of transaction pointers"
S ROOT=$G(ROOT)
S MESSNUM=+$G(MESSNUM)
I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number or reference to output array"
I (MESSNUM) Q:('$D(^XMB(3.9,MESSNUM))) "-1^Valid message number not passed"
S OFFSET=+$G(OFFSET)
;DECLARE VARIABLES
N TMP,X,LINE,TRANPTR,Y,TMPROOT
S LINE=OFFSET
;START PDX TRANSMISSION
S TMP="$TRANSMIT"
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
;LOOP THROUGH EACH TRANSACTION
S TRANPTR=""
F S TRANPTR=$O(@TRANARR@(TRANPTR)) Q:('TRANPTR) D Q:(TMP<0)
.;PLACE TRANSACTION POINTER INTO ROOT
.S TMP=$P(ROOT,"(",1)
.S X=$P(ROOT,"(",2)
.S Y=$P(X,")",1)
.S:(Y="") TMPROOT=TMP_"("_TRANPTR_")"
.S:(Y'="") TMPROOT=TMP_"("_Y_","_TRANPTR_")"
.S:(ROOT="") TMPROOT=""
.;PUT IN MESSAGE
.S TMP=$$MESSAGE^VAQCON0(TRANPTR,TMPROOT,MESSNUM,ARRAY,LINE)
.Q:(TMP<0)
.S LINE=LINE+TMP
Q:(TMP<0) TMP
;END PDX TRANSMISSION
S TMP="$$TRANSMIT"
S:('MESSNUM) @ARRAY@(LINE)=TMP
S:(MESSNUM) X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
S LINE=LINE+1
Q (LINE-OFFSET)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQCON 2668 printed Dec 13, 2024@02:24:41 Page 2
VAQCON ;ALB/JRP - MESSAGE CONSTRUCTION;14-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
XMIT(TRANARR,ROOT,MESSNUM,ARRAY,OFFSET) ;BUILD MESSAGE FOR TRANSACTION
+1 ;INPUT : TRANARR - Array whose subscripts are pointers to
+2 ; VAQ - TRANSACTION file (full global reference)
+3 ; ROOT - Location of Extraction Arrays (full global reference)
+4 ; MESSNUM - Message number to place transmisison into
+5 ; (if 0, transmission will be placed in ARRAY)
+6 ; ARRAY - Array to store transmission in (full global reference)
+7 ; OFFSET - Where to begin placing information (defaults to 0)
+8 ;OUTPUT : N - Number of lines in transmission
+9 ; -1^Error_Text - Error
+10 ;NOTES : Transactions pointed to by TRANARR will be placed in the
+11 ; same transmission and therefore should have the same domain
+12 ; as their destination.
+13 ; : If MESSNUM=0, then the transmission will be placed into
+14 ; ARRAY(LineNumber)=Line_of_info
+15 ; If MESSNUM>0 then the transmission will be placed into
+16 ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
+17 ; : The first subscript in ROOT must be a pointer to the
+18 ; transaction. The second subscript in ROOT must be the
+19 ; segment abbreviation. This is required to identify the
+20 ; segments for each transaction contained in a DATA or DISPLAY
+21 ; block. ( ROOT(TransactionPointer,SegmentAbbreviation) )
+22 ;
+23 ;CHECK INPUT
+24 if ($GET(TRANARR)="")
QUIT "-1^Did not pass reference to array of transaction pointers"
+25 SET ROOT=$GET(ROOT)
+26 SET MESSNUM=+$GET(MESSNUM)
+27 IF (('MESSNUM)&($GET(ARRAY)=""))
QUIT "-1^Did not pass message number or reference to output array"
+28 IF (MESSNUM)
if ('$DATA(^XMB(3.9,MESSNUM)))
QUIT "-1^Valid message number not passed"
+29 SET OFFSET=+$GET(OFFSET)
+30 ;DECLARE VARIABLES
+31 NEW TMP,X,LINE,TRANPTR,Y,TMPROOT
+32 SET LINE=OFFSET
+33 ;START PDX TRANSMISSION
+34 SET TMP="$TRANSMIT"
+35 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+36 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+37 SET LINE=LINE+1
+38 ;LOOP THROUGH EACH TRANSACTION
+39 SET TRANPTR=""
+40 FOR
SET TRANPTR=$ORDER(@TRANARR@(TRANPTR))
if ('TRANPTR)
QUIT
Begin DoDot:1
+41 ;PLACE TRANSACTION POINTER INTO ROOT
+42 SET TMP=$PIECE(ROOT,"(",1)
+43 SET X=$PIECE(ROOT,"(",2)
+44 SET Y=$PIECE(X,")",1)
+45 if (Y="")
SET TMPROOT=TMP_"("_TRANPTR_")"
+46 if (Y'="")
SET TMPROOT=TMP_"("_Y_","_TRANPTR_")"
+47 if (ROOT="")
SET TMPROOT=""
+48 ;PUT IN MESSAGE
+49 SET TMP=$$MESSAGE^VAQCON0(TRANPTR,TMPROOT,MESSNUM,ARRAY,LINE)
+50 if (TMP<0)
QUIT
+51 SET LINE=LINE+TMP
End DoDot:1
if (TMP<0)
QUIT
+52 if (TMP<0)
QUIT TMP
+53 ;END PDX TRANSMISSION
+54 SET TMP="$$TRANSMIT"
+55 if ('MESSNUM)
SET @ARRAY@(LINE)=TMP
+56 if (MESSNUM)
SET X=$$ADDLINE^VAQCON1(TMP,MESSNUM,LINE)
+57 SET LINE=LINE+1
+58 QUIT (LINE-OFFSET)