[613] | 1 | VAQPAR60 ;ALB/JRP - MESSAGE PARSING;28-APR-93
|
---|
| 2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
| 3 | MESSAGE(PRSARR,MESSNUM) ;PARSING OF VERSION 1.5 MESSAGE
|
---|
| 4 | ;INPUT : PRSARR - Parsing array (full global reference)
|
---|
| 5 | ; MESSNUM - Message number within transmission (not XMZ)
|
---|
| 6 | ; (defaults to 1)
|
---|
| 7 | ; (As defined by MailMan)
|
---|
| 8 | ; XMFROM, XMREC, XMZ
|
---|
| 9 | ; (Declared in SERVER^VAQADM2)
|
---|
| 10 | ; XMER, XMRG, XMPOS
|
---|
| 11 | ;OUTPUT : XMER - Exit condition
|
---|
| 12 | ; 0 = Success
|
---|
| 13 | ; -1^Error_Text = Error
|
---|
| 14 | ; XMPOS - Last line [number] read in transmission
|
---|
| 15 | ; (if NULL end of transmission reached)
|
---|
| 16 | ;NOTES : Parsing array will have the following format
|
---|
| 17 | ; ARRAY(MESSNUM,BlockName,BlockSeq,LineNumber) = Value
|
---|
| 18 | ; [BlockSeq used to keep blocks of same name from
|
---|
| 19 | ; overwritting each other. This will typically be '1'
|
---|
| 20 | ; except for DATA & DISPLAY blocks.]
|
---|
| 21 | ; : Calling routine responsible for ARRAY clean up before
|
---|
| 22 | ; and after call
|
---|
| 23 | ;
|
---|
| 24 | ;CHECK INPUT
|
---|
| 25 | I ($G(PRSARR)="") S XMER="-1^Did not pass reference to parsing array" Q
|
---|
| 26 | S:($G(MESSNUM)="") MESSNUM=1
|
---|
| 27 | ;DECLARE VARIABLES
|
---|
| 28 | N STOP,BLOCK,BLOCKSEQ,TMP,CURRENT,LAST
|
---|
| 29 | S XMER=0
|
---|
| 30 | S STOP=0
|
---|
| 31 | ;PARSE MESSAGE
|
---|
| 32 | F D Q:((XMER<0)!(STOP))
|
---|
| 33 | .S LAST=XMPOS
|
---|
| 34 | .X XMREC
|
---|
| 35 | .S CURRENT=XMPOS
|
---|
| 36 | .;END OF MESSAGE REACHED
|
---|
| 37 | .I (XMRG="$$MESSAGE") S XMER=0,STOP=1 Q
|
---|
| 38 | .;REACHED END OF MAILMAN MESSAGE
|
---|
| 39 | .I (XMER<0) S XMER="-1^End of message was not designated"
|
---|
| 40 | .;GET SEQUENCE NUMBER
|
---|
| 41 | .S BLOCK=$P(XMRG,"$",2)
|
---|
| 42 | .S BLOCKSEQ=0
|
---|
| 43 | .S TMP=""
|
---|
| 44 | .F S TMP=$O(@PRSARR@(MESSNUM,BLOCK,TMP)) Q:(TMP="") S BLOCKSEQ=TMP
|
---|
| 45 | .S BLOCKSEQ=BLOCKSEQ+1
|
---|
| 46 | .;PARSE VALID BLOCKS
|
---|
| 47 | .S XMPOS=LAST
|
---|
| 48 | .I (BLOCK="HEADER") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 49 | .I (BLOCK="DOMAIN") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 50 | .I (BLOCK="USER") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 51 | .I (BLOCK="PATIENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 52 | .I (BLOCK="SEGMENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 53 | .I (BLOCK="COMMENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 54 | .I (BLOCK="DATA") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 55 | .I (BLOCK="DISPLAY") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
|
---|
| 56 | .S:(XMPOS=LAST) XMPOS=CURRENT
|
---|
| 57 | .;EVERYTHING ELSE IS IGNORED
|
---|
| 58 | Q
|
---|