Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: VAQPAR60

VAQPAR60.m

Go to the documentation of this file.
  1. VAQPAR60 ;ALB/JRP - MESSAGE PARSING;28-APR-93
  1. ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
  1. MESSAGE(PRSARR,MESSNUM) ;PARSING OF VERSION 1.5 MESSAGE
  1. ;INPUT : PRSARR - Parsing array (full global reference)
  1. ; MESSNUM - Message number within transmission (not XMZ)
  1. ; (defaults to 1)
  1. ; (As defined by MailMan)
  1. ; XMFROM, XMREC, XMZ
  1. ; (Declared in SERVER^VAQADM2)
  1. ; XMER, XMRG, XMPOS
  1. ;OUTPUT : XMER - Exit condition
  1. ; 0 = Success
  1. ; -1^Error_Text = Error
  1. ; XMPOS - Last line [number] read in transmission
  1. ; (if NULL end of transmission reached)
  1. ;NOTES : Parsing array will have the following format
  1. ; ARRAY(MESSNUM,BlockName,BlockSeq,LineNumber) = Value
  1. ; [BlockSeq used to keep blocks of same name from
  1. ; overwritting each other. This will typically be '1'
  1. ; except for DATA & DISPLAY blocks.]
  1. ; : Calling routine responsible for ARRAY clean up before
  1. ; and after call
  1. ;
  1. ;CHECK INPUT
  1. I ($G(PRSARR)="") S XMER="-1^Did not pass reference to parsing array" Q
  1. S:($G(MESSNUM)="") MESSNUM=1
  1. ;DECLARE VARIABLES
  1. N STOP,BLOCK,BLOCKSEQ,TMP,CURRENT,LAST
  1. S XMER=0
  1. S STOP=0
  1. ;PARSE MESSAGE
  1. F D Q:((XMER<0)!(STOP))
  1. .S LAST=XMPOS
  1. .X XMREC
  1. .S CURRENT=XMPOS
  1. .;END OF MESSAGE REACHED
  1. .I (XMRG="$$MESSAGE") S XMER=0,STOP=1 Q
  1. .;REACHED END OF MAILMAN MESSAGE
  1. .I (XMER<0) S XMER="-1^End of message was not designated"
  1. .;GET SEQUENCE NUMBER
  1. .S BLOCK=$P(XMRG,"$",2)
  1. .S BLOCKSEQ=0
  1. .S TMP=""
  1. .F S TMP=$O(@PRSARR@(MESSNUM,BLOCK,TMP)) Q:(TMP="") S BLOCKSEQ=TMP
  1. .S BLOCKSEQ=BLOCKSEQ+1
  1. .;PARSE VALID BLOCKS
  1. .S XMPOS=LAST
  1. .I (BLOCK="HEADER") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="DOMAIN") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="USER") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="PATIENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="SEGMENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="COMMENT") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="DATA") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .I (BLOCK="DISPLAY") D BLOCK^VAQPAR61(PRSARR,MESSNUM,BLOCK,BLOCKSEQ) Q
  1. .S:(XMPOS=LAST) XMPOS=CURRENT
  1. .;EVERYTHING ELSE IS IGNORED
  1. Q