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

VAQFIL13.m

Go to the documentation of this file.
  1. VAQFIL13 ;ALB/JRP - MESSAGE FILING;12-MAY-93
  1. ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
  1. USER(MESSNUM,PARSARR,TRANPTR) ;FILE USER BLOCK
  1. ;INPUT : MESSNUM - Message number in transmission (not XMZ)
  1. ; (defaults to 1)
  1. ; PARSARR - Parsing array (full global reference)
  1. ; TRANPTR - Pointer to VAQ - TRANSACTION file
  1. ; (As defined by MailMan)
  1. ; XMFROM, XMREC,XMZ
  1. ;OUTPUT : 0 - Success
  1. ; -1^Error_Text - Error
  1. ;NOTES : It is the responsibility of the calling program to correct
  1. ; the transaction being updated if an error occurs.
  1. ;
  1. ;CHECK INPUT
  1. S:($G(MESSNUM)="") MESSNUM=1
  1. Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
  1. Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
  1. Q:('$D(@PARSARR@(MESSNUM,"USER",1))) "-1^Message did not contain a user block"
  1. S TRANPTR=+$G(TRANPTR)
  1. Q:(('TRANPTR)!('$D(^VAT(394.61,TRANPTR)))) "-1^Did not pass a valid transaction"
  1. ;DECLARE VARIABLES
  1. N TMP,TYPE,USERNAME,USERSITE,ERR
  1. ;MAKE SURE IT'S A USER BLOCK
  1. S TMP=$G(@PARSARR@(MESSNUM,"USER",1,1))
  1. S:(TMP=" ") TMP=""
  1. Q:((TMP="")!(TMP'="$USER")) "-1^Not a user block"
  1. S TMP=$G(@PARSARR@(MESSNUM,"USER",1,5))
  1. S:(TMP=" ") TMP=""
  1. Q:((TMP="")!(TMP'="$$USER")) "-1^Not a valid user block"
  1. ;GET MESSAGE TYPE
  1. S TMP=$$STATYPE^VAQFIL11(MESSNUM,PARSARR)
  1. Q:($P(TMP,"^",1)="-1") "-1^Could not determine message type"
  1. S TYPE=$P(TMP,"^",2)
  1. ;ACK OR RETRANSMIT DON'T HAVE USER BLOCKS
  1. Q:((TYPE="ACK")!(TYPE="RET")) "-1^Message type does not require user block"
  1. ;GET INFO
  1. S USERNAME=$G(@PARSARR@(MESSNUM,"USER",1,2))
  1. S:(USERNAME=" ") USERNAME=""
  1. S USERSITE=$G(@PARSARR@(MESSNUM,"USER",1,4))
  1. S:(USERSITE=" ") USERSITE=""
  1. ;FILE INFORMATION
  1. S ERR=0
  1. ;FILE NAME
  1. S TMP=$S((TYPE="REQ"):21,1:51)
  1. S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,TMP,USERNAME)
  1. Q:(ERR) "-1^Unable to file sender of transmission ("_USERNAME_")"
  1. ;FILE SITE
  1. S TMP=$S((TYPE="REQ"):30,1:60)
  1. S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,TMP,USERSITE)
  1. Q:(ERR) "-1^Unable to file sending facility of transmission ("_USERSITE_")"
  1. Q 0
  1. ;
  1. SENDER(MESSNUM,PARSARR) ;RETURN SENDER OF PARSED MESSAGE
  1. ;INPUT : MESSNUM - Message number in transmission (not XMZ)
  1. ; (defaults to 1)
  1. ; PARSARR - Parsing array (full global reference)
  1. ;OUTPUT : Name^DUZ - Success
  1. ; -1^Error_Text - Error
  1. ;
  1. ;CHECK INPUT
  1. S:($G(MESSNUM)="") MESSNUM=1
  1. Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
  1. Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
  1. Q:('$D(@PARSARR@(MESSNUM,"USER",1))) "-1^Message did not contain a user block"
  1. ;DECLARE VARIABLES
  1. N USERNAME,USERDUZ
  1. S USERNAME=$G(@PARSARR@(MESSNUM,"USER",1,2))
  1. S:(USERNAME=" ") USERNAME=""
  1. Q:(USERNAME="") "-1^Could not determine sender of message"
  1. S USERDUZ=$G(@PARSARR@(MESSNUM,"USER",1,3))
  1. S:(USERDUZ=" ") USERDUZ=""
  1. Q:(USERDUZ="") "-1^Could not determine sender of message"
  1. Q USERNAME_"^"_USERDUZ
  1. ;
  1. KEY(MESSNUM,PARSARR,PRIME) ;RETURN SENDER OF PARSED MESSAGE
  1. ;INPUT : MESSNUM - Message number in transmission (not XMZ)
  1. ; (defaults to 1)
  1. ; PARSARR - Parsing array (full global reference)
  1. ; PRIME - Indicates which key to return
  1. ; 0 = Return secondary key (default)
  1. ; Returns NULL on error
  1. ; 1 = Return primary key
  1. ; Returns NULL on error
  1. ;OUTPUT : See definition of PRIME
  1. ;
  1. ;CHECK INPUT
  1. S:($G(MESSNUM)="") MESSNUM=1
  1. Q:($G(PARSARR)="") ""
  1. Q:('$D(@PARSARR@(MESSNUM))) ""
  1. Q:('$D(@PARSARR@(MESSNUM,"USER",1))) ""
  1. S PRIME=+$G(PRIME)
  1. ;DECLARE VARIABLES
  1. N SENDER
  1. ;GET SENDER
  1. S SENDER=$$SENDER(MESSNUM,PARSARR)
  1. Q:($P(SENDER,"^",1)="-1") ""
  1. S SENDER=$P(SENDER,"^",1)
  1. ;RETURN KEY
  1. Q $$NAMEKEY^VAQUTL3(SENDER,PRIME)