VAQPAR6 ;ALB/JRP - MESSAGE PARSING;28-APR-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
PARSE(ARRAY) ;PARSING OF VERSION 1.5 TRANSMISSION
;INPUT : ARRAY - Parsing array (full global reference)
; (As defined by MailMan)
; XMFROM, XMREC, XMZ
; (Declared in SERVER^VAQADM2)
; XMER, XMRG, XMPOS
;OUTPUT : XMER - Exit condition
; 0 = Success
; -1^Error_Text = Error
; XMPOS - Last line [number] read in transmission
; (if NULL end of transmission reached)
;NOTES : Parsing array will have the following format
; ARRAY(MessageNumber,BlockName,BlockSeq,LineNumber) = Value
; [BlockSeq used to keep blocks of same name from
; overwritting each other. This will typically be '1'
; except for DATA & DISPLAY blocks.]
; [MessageNumber is not XMZ ... it denotes the message
; number withing the transmission]
; : Calling routine responsible for ARRAY clean up before
; and after call
;
;CHECK INPUT
I ($G(ARRAY)="") S XMER="-1^Did not pass reference to parsing array" Q
;DECLARE VARIABLES
N MESSAGE,DONE
S XMER=0
;READ TRANSMISSION
X XMREC
I ((XMER<0)!(XMRG="")) S XMER="-1^Transmission did not contain any information" Q
I (XMRG'="$TRANSMIT") S XMER="-1^Not a valid transmission" Q
S MESSAGE=0
S DONE=0
;PARSE TRANSMISSION
F D Q:((XMER<0)!(DONE))
.X XMREC
.;END OF TRANSMISSION REACHED
.I (XMRG="$$TRANSMIT") S XMER=0,DONE=1 Q
.;REACHED END OF MAILMAN MESSAGE
.I (XMER<0) S XMER="-1^End of transmission was not designated" Q
.;BEGINNING OF A MESSAGE
.I (XMRG="$MESSAGE") D Q
..S MESSAGE=MESSAGE+1
..;PARSE MESSAGE
..D MESSAGE^VAQPAR60(ARRAY,MESSAGE)
.;EVERYTHING ELSE IS IGNORED
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQPAR6 1817 printed Mar 13, 2024@23:36:10 Page 2
VAQPAR6 ;ALB/JRP - MESSAGE PARSING;28-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
PARSE(ARRAY) ;PARSING OF VERSION 1.5 TRANSMISSION
+1 ;INPUT : ARRAY - Parsing array (full global reference)
+2 ; (As defined by MailMan)
+3 ; XMFROM, XMREC, XMZ
+4 ; (Declared in SERVER^VAQADM2)
+5 ; XMER, XMRG, XMPOS
+6 ;OUTPUT : XMER - Exit condition
+7 ; 0 = Success
+8 ; -1^Error_Text = Error
+9 ; XMPOS - Last line [number] read in transmission
+10 ; (if NULL end of transmission reached)
+11 ;NOTES : Parsing array will have the following format
+12 ; ARRAY(MessageNumber,BlockName,BlockSeq,LineNumber) = Value
+13 ; [BlockSeq used to keep blocks of same name from
+14 ; overwritting each other. This will typically be '1'
+15 ; except for DATA & DISPLAY blocks.]
+16 ; [MessageNumber is not XMZ ... it denotes the message
+17 ; number withing the transmission]
+18 ; : Calling routine responsible for ARRAY clean up before
+19 ; and after call
+20 ;
+21 ;CHECK INPUT
+22 IF ($GET(ARRAY)="")
SET XMER="-1^Did not pass reference to parsing array"
QUIT
+23 ;DECLARE VARIABLES
+24 NEW MESSAGE,DONE
+25 SET XMER=0
+26 ;READ TRANSMISSION
+27 XECUTE XMREC
+28 IF ((XMER<0)!(XMRG=""))
SET XMER="-1^Transmission did not contain any information"
QUIT
+29 IF (XMRG'="$TRANSMIT")
SET XMER="-1^Not a valid transmission"
QUIT
+30 SET MESSAGE=0
+31 SET DONE=0
+32 ;PARSE TRANSMISSION
+33 FOR
Begin DoDot:1
+34 XECUTE XMREC
+35 ;END OF TRANSMISSION REACHED
+36 IF (XMRG="$$TRANSMIT")
SET XMER=0
SET DONE=1
QUIT
+37 ;REACHED END OF MAILMAN MESSAGE
+38 IF (XMER<0)
SET XMER="-1^End of transmission was not designated"
QUIT
+39 ;BEGINNING OF A MESSAGE
+40 IF (XMRG="$MESSAGE")
Begin DoDot:2
+41 SET MESSAGE=MESSAGE+1
+42 ;PARSE MESSAGE
+43 DO MESSAGE^VAQPAR60(ARRAY,MESSAGE)
End DoDot:2
QUIT
+44 ;EVERYTHING ELSE IS IGNORED
End DoDot:1
if ((XMER<0)!(DONE))
QUIT
+45 QUIT