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