VAQCON97 ;ALB/JRP - MESSAGE CONSTRUCTION;19-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
DATA10(TRANPTR,ROOT,MESSNUM,ARRAY,OFFSET) ;BUILD DATA BLOCK FOR VERSION 1.0
;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
; ROOT - Location of Extraction Arrays (full global reference)
; MESSNUM - Message number to place message into
; (if 0, message will be placed in ARRAY)
; ARRAY - Array to store message in (full global reference)
; OFFSET - Where to begin placing information (defaults to 0)
;OUTPUT : N - Number of lines in message
; -1^Error_Text - Error
;NOTES : If MESSNUM=0, then the message will be placed into
; ARRAY(LineNumber)=Line_of_info
; If MESSNUM>0 then the message will be placed into
; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
; : The first subscript in ROOT must be the segment abbreviation
; (i.e. ROOT(SegmentAbbreviation)). This is required to
; identify the segments.
;
;CHECK INPUT
S TRANPTR=+$G(TRANPTR)
Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
S ROOT=$G(ROOT)
S MESSNUM=+$G(MESSNUM)
I (('MESSNUM)&($G(ARRAY)="")) Q "-1^Did not pass message number or reference to 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,STATUS,TYPE,SEGABB,FILE,FIELD,SEQ,INFO,VALUE,SEQFIELD
S LINE=OFFSET
;DETERMINE STATUS & TYPE
S TMP=$$STATYPE^VAQCON1(TRANPTR)
Q:($P(TMP,"^",1)="-1") TMP
S STATUS=$P(TMP,"^",1)
S TYPE=$P(TMP,"^",2)
;MAKE SURE MESSAGE SHOULD CONTAIN DATA
Q:((TYPE'="RES")&(TYPE'="UNS")) "-1^Message type does not return data"
Q:((STATUS'="VAQ-RSLT")&(STATUS'="VAQ-UNSOL")) "-1^Message type does not return data"
Q:(TYPE="REC") "-1^Transaction is being received, not transmitted"
;PLACE MINIMUM INFORMATION INTO MESSAGE
D MIN10^VAQCON98
;PLACE MAS INFORMATION INTO MESSAGE
D MAS10^VAQCON96
;PLACE PHARMACY INFORMATION INTO MESSAGE
D PHA10^VAQCON95
Q (LINE-OFFSET)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQCON97 2142 printed Nov 22, 2024@17:34:57 Page 2
VAQCON97 ;ALB/JRP - MESSAGE CONSTRUCTION;19-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
DATA10(TRANPTR,ROOT,MESSNUM,ARRAY,OFFSET) ;BUILD DATA BLOCK FOR VERSION 1.0
+1 ;INPUT : TRANPTR - Pointer to VAQ - TRANSACTION file
+2 ; ROOT - Location of Extraction Arrays (full global reference)
+3 ; MESSNUM - Message number to place message into
+4 ; (if 0, message will be placed in ARRAY)
+5 ; ARRAY - Array to store message in (full global reference)
+6 ; OFFSET - Where to begin placing information (defaults to 0)
+7 ;OUTPUT : N - Number of lines in message
+8 ; -1^Error_Text - Error
+9 ;NOTES : If MESSNUM=0, then the message will be placed into
+10 ; ARRAY(LineNumber)=Line_of_info
+11 ; If MESSNUM>0 then the message will be placed into
+12 ; ^XMB(3.9,MESSNUM,2,LineNumber,0)=Line_of_info
+13 ; : The first subscript in ROOT must be the segment abbreviation
+14 ; (i.e. ROOT(SegmentAbbreviation)). This is required to
+15 ; identify the segments.
+16 ;
+17 ;CHECK INPUT
+18 SET TRANPTR=+$GET(TRANPTR)
+19 if (('TRANPTR)!('$DATA(^VAT(394.61,TRANPTR))))
QUIT "-1^Did not pass a valid pointer to VAQ - TRANSACTION file"
+20 SET ROOT=$GET(ROOT)
+21 SET MESSNUM=+$GET(MESSNUM)
+22 IF (('MESSNUM)&($GET(ARRAY)=""))
QUIT "-1^Did not pass message number or reference to array"
+23 IF (MESSNUM)
if ('$DATA(^XMB(3.9,MESSNUM)))
QUIT "-1^Valid message number not passed"
+24 SET OFFSET=+$GET(OFFSET)
+25 ;DECLARE VARIABLES
+26 NEW TMP,X,LINE,STATUS,TYPE,SEGABB,FILE,FIELD,SEQ,INFO,VALUE,SEQFIELD
+27 SET LINE=OFFSET
+28 ;DETERMINE STATUS & TYPE
+29 SET TMP=$$STATYPE^VAQCON1(TRANPTR)
+30 if ($PIECE(TMP,"^",1)="-1")
QUIT TMP
+31 SET STATUS=$PIECE(TMP,"^",1)
+32 SET TYPE=$PIECE(TMP,"^",2)
+33 ;MAKE SURE MESSAGE SHOULD CONTAIN DATA
+34 if ((TYPE'="RES")&(TYPE'="UNS"))
QUIT "-1^Message type does not return data"
+35 if ((STATUS'="VAQ-RSLT")&(STATUS'="VAQ-UNSOL"))
QUIT "-1^Message type does not return data"
+36 if (TYPE="REC")
QUIT "-1^Transaction is being received, not transmitted"
+37 ;PLACE MINIMUM INFORMATION INTO MESSAGE
+38 DO MIN10^VAQCON98
+39 ;PLACE MAS INFORMATION INTO MESSAGE
+40 DO MAS10^VAQCON96
+41 ;PLACE PHARMACY INFORMATION INTO MESSAGE
+42 DO PHA10^VAQCON95
+43 QUIT (LINE-OFFSET)