VAQFIL11 ;ALB/JRP - MESSAGE FILING;12-MAY-93
;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
; DECLARATIONS DONE IN $$HEADER^VAQFIL10
;FILE RECEIVING MESSAGE STATUS
S ERR=0
S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.02,"VAQ-RCVE")
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to mark transaction as a transmission that is being received" Q
;DONE IF ACK
Q:(TYPE="ACK")
;FILE REMOTE VERSION NUMBER
S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.07,VERSION)
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file remote version number ("_VERSION_")" Q
;DONE IF RETRANSMIT
Q:(TYPE="RET")
;FILE DATE & TIME OF TRANSMISSION
S TMP=$S((TYPE="REQ"):20,1:50)
S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,TMP,DATETIME)
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file date & time ("_DATETIME_")" Q
;FILE DATE & TIME UNSOLICITED RECEIVED
I (STATUS="VAQ-UNSOL") D Q:(ERR)
.S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,20,"NOW")
.I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file date & time Unsolicited was received"
;FILE REMOTE TRANSACTION NUMBER
S:(TYPE'="RES") ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.06,TRANSNUM)
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file remote transaction number ("_TRANSNUM_")" Q
;FILE ENCRYPTION FLAG
S TMP=$S((ENCMTHD=""):"NO",1:"YES")
S ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,40,TMP)
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file encryption flag ("_$S((ENCMTHD=""):"NO",1:"YES")_")" Q
;FILE ENCRYPTION METHOD
S:(ENCMTHD'="") ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,41,ENCMTHD)
I (ERR) S:(NEWTRAN) TMP=$$DELTRAN^VAQFILE(TRANPTR) S ERR="-1^Unable to file encryption method ("_ENCMTHD_")" Q
S ERR=0
Q
;
STATYPE(MESSNUM,PARSARR) ;RETURN STATUS & TYPE FOR A PARSED MESSAGE
;INPUT : MESSNUM - Message number in transmission (not XMZ)
; (defaults to 1)
; PARSARR - Parsing array (full global reference)
;OUTPUT : Status^Type - Success
; -1^Error_Text - Error
;
;CHECK INPUT
S:($G(MESSNUM)="") MESSNUM=1
Q:($G(PARSARR)="") "-1^Did not pass reference to parsing array"
Q:('$D(@PARSARR@(MESSNUM))) "-1^Did not pass valid message number"
Q:('$D(@PARSARR@(MESSNUM,"HEADER",1))) "-1^Message did not contain a header block"
;DECLARE VARIABLES
N STATUS,TYPE
S TYPE=$G(@PARSARR@(MESSNUM,"HEADER",1,2))
S:(TYPE=" ") TYPE=""
Q:(TYPE="") "-1^Could not determine message type"
S STATUS=$G(@PARSARR@(MESSNUM,"HEADER",1,3))
S:(STATUS=" ") STATUS=""
Q:(STATUS="") "-1^Could not determine message status"
Q STATUS_"^"_TYPE
;
DECMTHD(MESSNUM,PARSARR,RET) ;RETURN DECRYPTION METHOD FOR A PARSED MESSAGE
;INPUT : MESSNUM - Message number in transmission (not XMZ)
; (defaults to 1)
; PARSARR - Parsing array (full global reference)
; RET - Flag indicating what to return
; 1 = Return pointer to VAQ - ENCRYPTION file (default)
; Return 0 if no encryption listed
; 2 = Return decryption method
; Return "" if no encryption listed
; 3 = Return type of encryption used
; Return "" if no encryption listed
;OUTPUT : See definition of RET
;
;CHECK INPUT
S:($G(MESSNUM)="") MESSNUM=1
Q:($G(PARSARR)="") ""
Q:('$D(@PARSARR@(MESSNUM))) ""
Q:('$D(@PARSARR@(MESSNUM,"HEADER",1))) ""
S RET=+$G(RET)
S:('RET) RET=1
;DECLARE VARIABLES
N PTR,TYPE
;GET TYPE OF ENCRYPTION USED
S TYPE=$G(@PARSARR@(MESSNUM,"HEADER",1,8))
S:(TYPE=" ") TYPE=""
;NONE LISTED
Q:(TYPE="") $S((RET=1):0,1:"")
;RETURN TYPE
Q:(RET=3) TYPE
;GET POINTER
S PTR=+$O(^VAT(394.72,"B",TYPE,""))
Q:(RET=1) PTR
Q:('PTR) ""
;GET METHOD
Q $G(^VAT(394.72,PTR,"DCR"))
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQFIL11 3893 printed Dec 13, 2024@02:25:46 Page 2
VAQFIL11 ;ALB/JRP - MESSAGE FILING;12-MAY-93
+1 ;;1.5;PATIENT DATA EXCHANGE;;NOV 17, 1993
+1 ; DECLARATIONS DONE IN $$HEADER^VAQFIL10
+2 ;FILE RECEIVING MESSAGE STATUS
+3 SET ERR=0
+4 SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.02,"VAQ-RCVE")
+5 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to mark transaction as a transmission that is being received"
QUIT
+6 ;DONE IF ACK
+7 if (TYPE="ACK")
QUIT
+8 ;FILE REMOTE VERSION NUMBER
+9 SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.07,VERSION)
+10 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file remote version number ("_VERSION_")"
QUIT
+11 ;DONE IF RETRANSMIT
+12 if (TYPE="RET")
QUIT
+13 ;FILE DATE & TIME OF TRANSMISSION
+14 SET TMP=$SELECT((TYPE="REQ"):20,1:50)
+15 SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,TMP,DATETIME)
+16 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file date & time ("_DATETIME_")"
QUIT
+17 ;FILE DATE & TIME UNSOLICITED RECEIVED
+18 IF (STATUS="VAQ-UNSOL")
Begin DoDot:1
+19 SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,20,"NOW")
+20 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file date & time Unsolicited was received"
End DoDot:1
if (ERR)
QUIT
+21 ;FILE REMOTE TRANSACTION NUMBER
+22 if (TYPE'="RES")
SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,.06,TRANSNUM)
+23 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file remote transaction number ("_TRANSNUM_")"
QUIT
+24 ;FILE ENCRYPTION FLAG
+25 SET TMP=$SELECT((ENCMTHD=""):"NO",1:"YES")
+26 SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,40,TMP)
+27 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file encryption flag ("_$SELECT((ENCMTHD=""):"NO",1:"YES")_")"
QUIT
+28 ;FILE ENCRYPTION METHOD
+29 if (ENCMTHD'="")
SET ERR=$$FILEINFO^VAQFILE(394.61,TRANPTR,41,ENCMTHD)
+30 IF (ERR)
if (NEWTRAN)
SET TMP=$$DELTRAN^VAQFILE(TRANPTR)
SET ERR="-1^Unable to file encryption method ("_ENCMTHD_")"
QUIT
+31 SET ERR=0
+32 QUIT
+33 ;
STATYPE(MESSNUM,PARSARR) ;RETURN STATUS & TYPE FOR A PARSED MESSAGE
+1 ;INPUT : MESSNUM - Message number in transmission (not XMZ)
+2 ; (defaults to 1)
+3 ; PARSARR - Parsing array (full global reference)
+4 ;OUTPUT : Status^Type - Success
+5 ; -1^Error_Text - Error
+6 ;
+7 ;CHECK INPUT
+8 if ($GET(MESSNUM)="")
SET MESSNUM=1
+9 if ($GET(PARSARR)="")
QUIT "-1^Did not pass reference to parsing array"
+10 if ('$DATA(@PARSARR@(MESSNUM)))
QUIT "-1^Did not pass valid message number"
+11 if ('$DATA(@PARSARR@(MESSNUM,"HEADER",1)))
QUIT "-1^Message did not contain a header block"
+12 ;DECLARE VARIABLES
+13 NEW STATUS,TYPE
+14 SET TYPE=$GET(@PARSARR@(MESSNUM,"HEADER",1,2))
+15 if (TYPE=" ")
SET TYPE=""
+16 if (TYPE="")
QUIT "-1^Could not determine message type"
+17 SET STATUS=$GET(@PARSARR@(MESSNUM,"HEADER",1,3))
+18 if (STATUS=" ")
SET STATUS=""
+19 if (STATUS="")
QUIT "-1^Could not determine message status"
+20 QUIT STATUS_"^"_TYPE
+21 ;
DECMTHD(MESSNUM,PARSARR,RET) ;RETURN DECRYPTION METHOD FOR A PARSED MESSAGE
+1 ;INPUT : MESSNUM - Message number in transmission (not XMZ)
+2 ; (defaults to 1)
+3 ; PARSARR - Parsing array (full global reference)
+4 ; RET - Flag indicating what to return
+5 ; 1 = Return pointer to VAQ - ENCRYPTION file (default)
+6 ; Return 0 if no encryption listed
+7 ; 2 = Return decryption method
+8 ; Return "" if no encryption listed
+9 ; 3 = Return type of encryption used
+10 ; Return "" if no encryption listed
+11 ;OUTPUT : See definition of RET
+12 ;
+13 ;CHECK INPUT
+14 if ($GET(MESSNUM)="")
SET MESSNUM=1
+15 if ($GET(PARSARR)="")
QUIT ""
+16 if ('$DATA(@PARSARR@(MESSNUM)))
QUIT ""
+17 if ('$DATA(@PARSARR@(MESSNUM,"HEADER",1)))
QUIT ""
+18 SET RET=+$GET(RET)
+19 if ('RET)
SET RET=1
+20 ;DECLARE VARIABLES
+21 NEW PTR,TYPE
+22 ;GET TYPE OF ENCRYPTION USED
+23 SET TYPE=$GET(@PARSARR@(MESSNUM,"HEADER",1,8))
+24 if (TYPE=" ")
SET TYPE=""
+25 ;NONE LISTED
+26 if (TYPE="")
QUIT $SELECT((RET=1):0,1:"")
+27 ;RETURN TYPE
+28 if (RET=3)
QUIT TYPE
+29 ;GET POINTER
+30 SET PTR=+$ORDER(^VAT(394.72,"B",TYPE,""))
+31 if (RET=1)
QUIT PTR
+32 if ('PTR)
QUIT ""
+33 ;GET METHOD
+34 QUIT $GET(^VAT(394.72,PTR,"DCR"))