| 1 | VAQPAR61 ;ALB/JRP - MESSAGE PARSING;28-APR-93
|
---|
| 2 | ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
|
---|
| 3 | BLOCK(PRSARR,MESSNUM,BLOCK,BLOCKNUM) ;PARSING OF VERSION 1.5 MESSAGE BLOCKS
|
---|
| 4 | ;INPUT : PRSARR - Parsing array (full global reference)
|
---|
| 5 | ; MESSNUM - Message number within transmission (not XMZ)
|
---|
| 6 | ; (defaults to 1)
|
---|
| 7 | ; BLOCK - Block name
|
---|
| 8 | ; BLOCKNUM - Block number with message (defaults to 1)
|
---|
| 9 | ; (As defined by MailMan)
|
---|
| 10 | ; XMFROM, XMREC, XMZ
|
---|
| 11 | ; (Declared in SERVER^VAQADM2)
|
---|
| 12 | ; XMER, XMRG, XMPOS
|
---|
| 13 | ;OUTPUT : XMER - Exit condition
|
---|
| 14 | ; 0 = Success
|
---|
| 15 | ; -1^Error_Text = Error
|
---|
| 16 | ; XMPOS - Last line [number] read in transmission
|
---|
| 17 | ; (if NULL end of transmission reached)
|
---|
| 18 | ;
|
---|
| 19 | ;NOTES : Parsing array will have the following format
|
---|
| 20 | ; ARRAY(MESSNUM,BLOCK,BLOCKNUM,LineNumber) = Value
|
---|
| 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 | I ($G(BLOCK)="") S XMER="-1^Did not pass block name" Q
|
---|
| 28 | S:($G(BLOCKNUM)="") BLOCKNUM=1
|
---|
| 29 | S XMER="-1^Block not supported"
|
---|
| 30 | Q:((BLOCK'="HEADER")&(BLOCK'="DOMAIN")&(BLOCK'="USER")&(BLOCK'="PATIENT")&(BLOCK'="SEGMENT")&(BLOCK'="COMMENT")&(BLOCK'="DATA")&(BLOCK'="DISPLAY"))
|
---|
| 31 | ;DECLARE VARIABLES
|
---|
| 32 | N END,BLOCKEND,LINE
|
---|
| 33 | S XMER=0
|
---|
| 34 | S END=0
|
---|
| 35 | S BLOCKEND="$$"_BLOCK
|
---|
| 36 | ;PARSE BLOCK
|
---|
| 37 | F LINE=1:1 D Q:((XMER<0)!(END))
|
---|
| 38 | .X XMREC
|
---|
| 39 | .;END OF BLOCK REACHED
|
---|
| 40 | .I (XMRG=BLOCKEND) S XMER=0,END=1 Q
|
---|
| 41 | .;REACHED END OF MAILMAN MESSAGE
|
---|
| 42 | .I (XMER<0) S XMER="-1^End of block was not designated"
|
---|
| 43 | .;STORE INFO IN PARSE ARRAY
|
---|
| 44 | .S @PRSARR@(MESSNUM,BLOCK,BLOCKNUM,LINE)=XMRG
|
---|
| 45 | S @PRSARR@(MESSNUM,BLOCK,BLOCKNUM,LINE)=XMRG
|
---|
| 46 | Q
|
---|