VAQUTL2 ;ALB/JRP - UTILITY ROUTINES;30-APR-93
;;1.5;PATIENT DATA EXCHANGE;**5**;NOV 17, 1993
NCRYPTON(RETMTHD) ;DETERMINE IF ENCRYPTION HAS BEEN TURNED ON
;INPUT : RETMTHD - Flag indicating what to return
; 0 = Return pointer to default encryption (default)
; Return 0 if encryption is off
; 1 = Return default encryption method
; Return NULL if encryption is off
; 2 = Return default encryption type
; Return NULL if encryption is off
;OUTPUT : See definition of RETMTHD
;NOTES : Existance of VAQIGNC will be checked. If it exists and is
; set to 1 encryption rules will be ignored.
; : Encryption off will be returned on error
;
;CHECK INPUT
S RETMTHD=+$G(RETMTHD)
;IGNORE FLAG TURNED ON
I (+$G(VAQIGNC)) Q $S(RETMTHD:"",1:0)
;DECLARE VARIABLES
N X,Y
;GET ENTRY IN PARAMETER FILE
S X=$O(^VAT(394.81,0))
;COULDN'T FIND ENTRY IN PARAMETER - ASSUME ENCRYPTION IS OFF
Q:('X) $S(RETMTHD:"",1:0)
;CHECK ENCRYPTION FLAG
S Y=$G(^VAT(394.81,X,"ECR"))
;COULDN'T FIND ENCRYPTION FLAG - ASSUME ENCRYPTION IS OFF
Q:('Y) $S(RETMTHD:"",1:0)
;ENCRYPTION TURNED ON
S X=+$P(Y,"^",2)
;RETURN POINTER
Q:('RETMTHD) X
;RETURN METHOD
Q:(RETMTHD=1) $$ENCMTHD(X,0)
;RETURN TYPE
Q $P($G(^VAT(394.72,X,0)),"^",1)
;
NCRPFLD(FILE,FIELD) ;DETERMINE IF A FILE/FIELD IS MARKED FOR ENCRYPTION
;INPUT : FILE - File number
; FIELD - Field number
; VAQIGNC - Indicates if encryption rules should be ignored
; If 1, ignore encryption rules (never encrypt)
; If 0 or doesn't exist, obey encryption rules (default)
;OUTPUT : 1 - File/field is marked for encryption
; 0 - File/field not marked for encryption
;
;CHECK INPUT (ASSUME NOT MARKED ON ERROR)
S FILE=+$G(FILE)
S FIELD=+$G(FIELD)
Q:(('FILE)!('FIELD)) 0
;IGNORE FLAG TURNED ON
Q:(+$G(VAQIGNC)) 0
;NOT MARKED FOR ENCRYPTION
Q:('$D(^VAT(394.73,"A-NCRYPT",FILE,FIELD))) 0
;MARKED
Q 1
;
ENCMTHD(ENCPTR,DCRYPT) ;RETURN ENCRYPTION/DECRYPTION METHOD
;INPUT : ENCPTR - Pointer to VAQ - ENCRYPTION METHOD file
; DCRYPT - Indicates which method to return
; If 0, return encryption method (default)
; If 1, return decryption method
;OUTPUT : The encryption/decryption method
; NULL - Error
;
;CHECK INPUT
S ENCPTR=+$G(ENCPTR)
Q:('ENCPTR) ""
S DCRYPT=+$G(DCRYPT)
;RETURN DECRYPTION METHOD
Q:(DCRYPT) $G(^VAT(394.72,ENCPTR,"DCR"))
;RETURN ENCRYPTION METHOD
Q $G(^VAT(394.72,ENCPTR,"ECR"))
;
DEFENC(DCRYPT,POINT) ;RETURN DEFAULT ENCRYPTION/DECRYPTION METHOD
;INPUT : DCRYPT - Indicates which method to return
; If 0, return encryption method (default)
; If 1, return decryption method
; POINT - Indicates if a pointer to VAQ - ENCRYPTION METHOD
; file should be returned
; If 0, return method (default)
; If 1, return pointer to method
;OUTPUT : If method is requested
; The default encryption/decryption method
; NULL - Error
; If pointer is requested
; Pointer to VAQ - ENCRYPTION METHOD
; 0 - Error
;
;CHECK INPUT
S DCRYPT=+$G(DCRYPT)
S POINT=+$G(POINT)
;DECLARE VARIABLES
N X,Y
;GET ENTRY IN PARAMTER FILE
S X=$O(^VAT(394.81,0))
;COULDN'T FIND ENTRY IN PARAMETER
Q:('X) ""
;GET POINTER TO METHOD
S Y=$G(^VAT(394.81,X,"ECR"))
S Y=+$P(Y,"^",2)
;POINTER TO METHOD DIDN'T EXIST
Q:('Y) $S(POINT:0,1:"")
;RETURN POINTER
Q:(POINT) Y
;RETURN METHOD
Q $$ENCMTHD(Y,DCRYPT)
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HVAQUTL2 3716 printed Nov 22, 2024@17:36:59 Page 2
VAQUTL2 ;ALB/JRP - UTILITY ROUTINES;30-APR-93
+1 ;;1.5;PATIENT DATA EXCHANGE;**5**;NOV 17, 1993
NCRYPTON(RETMTHD) ;DETERMINE IF ENCRYPTION HAS BEEN TURNED ON
+1 ;INPUT : RETMTHD - Flag indicating what to return
+2 ; 0 = Return pointer to default encryption (default)
+3 ; Return 0 if encryption is off
+4 ; 1 = Return default encryption method
+5 ; Return NULL if encryption is off
+6 ; 2 = Return default encryption type
+7 ; Return NULL if encryption is off
+8 ;OUTPUT : See definition of RETMTHD
+9 ;NOTES : Existance of VAQIGNC will be checked. If it exists and is
+10 ; set to 1 encryption rules will be ignored.
+11 ; : Encryption off will be returned on error
+12 ;
+13 ;CHECK INPUT
+14 SET RETMTHD=+$GET(RETMTHD)
+15 ;IGNORE FLAG TURNED ON
+16 IF (+$GET(VAQIGNC))
QUIT $SELECT(RETMTHD:"",1:0)
+17 ;DECLARE VARIABLES
+18 NEW X,Y
+19 ;GET ENTRY IN PARAMETER FILE
+20 SET X=$ORDER(^VAT(394.81,0))
+21 ;COULDN'T FIND ENTRY IN PARAMETER - ASSUME ENCRYPTION IS OFF
+22 if ('X)
QUIT $SELECT(RETMTHD:"",1:0)
+23 ;CHECK ENCRYPTION FLAG
+24 SET Y=$GET(^VAT(394.81,X,"ECR"))
+25 ;COULDN'T FIND ENCRYPTION FLAG - ASSUME ENCRYPTION IS OFF
+26 if ('Y)
QUIT $SELECT(RETMTHD:"",1:0)
+27 ;ENCRYPTION TURNED ON
+28 SET X=+$PIECE(Y,"^",2)
+29 ;RETURN POINTER
+30 if ('RETMTHD)
QUIT X
+31 ;RETURN METHOD
+32 if (RETMTHD=1)
QUIT $$ENCMTHD(X,0)
+33 ;RETURN TYPE
+34 QUIT $PIECE($GET(^VAT(394.72,X,0)),"^",1)
+35 ;
NCRPFLD(FILE,FIELD) ;DETERMINE IF A FILE/FIELD IS MARKED FOR ENCRYPTION
+1 ;INPUT : FILE - File number
+2 ; FIELD - Field number
+3 ; VAQIGNC - Indicates if encryption rules should be ignored
+4 ; If 1, ignore encryption rules (never encrypt)
+5 ; If 0 or doesn't exist, obey encryption rules (default)
+6 ;OUTPUT : 1 - File/field is marked for encryption
+7 ; 0 - File/field not marked for encryption
+8 ;
+9 ;CHECK INPUT (ASSUME NOT MARKED ON ERROR)
+10 SET FILE=+$GET(FILE)
+11 SET FIELD=+$GET(FIELD)
+12 if (('FILE)!('FIELD))
QUIT 0
+13 ;IGNORE FLAG TURNED ON
+14 if (+$GET(VAQIGNC))
QUIT 0
+15 ;NOT MARKED FOR ENCRYPTION
+16 if ('$DATA(^VAT(394.73,"A-NCRYPT",FILE,FIELD)))
QUIT 0
+17 ;MARKED
+18 QUIT 1
+19 ;
ENCMTHD(ENCPTR,DCRYPT) ;RETURN ENCRYPTION/DECRYPTION METHOD
+1 ;INPUT : ENCPTR - Pointer to VAQ - ENCRYPTION METHOD file
+2 ; DCRYPT - Indicates which method to return
+3 ; If 0, return encryption method (default)
+4 ; If 1, return decryption method
+5 ;OUTPUT : The encryption/decryption method
+6 ; NULL - Error
+7 ;
+8 ;CHECK INPUT
+9 SET ENCPTR=+$GET(ENCPTR)
+10 if ('ENCPTR)
QUIT ""
+11 SET DCRYPT=+$GET(DCRYPT)
+12 ;RETURN DECRYPTION METHOD
+13 if (DCRYPT)
QUIT $GET(^VAT(394.72,ENCPTR,"DCR"))
+14 ;RETURN ENCRYPTION METHOD
+15 QUIT $GET(^VAT(394.72,ENCPTR,"ECR"))
+16 ;
DEFENC(DCRYPT,POINT) ;RETURN DEFAULT ENCRYPTION/DECRYPTION METHOD
+1 ;INPUT : DCRYPT - Indicates which method to return
+2 ; If 0, return encryption method (default)
+3 ; If 1, return decryption method
+4 ; POINT - Indicates if a pointer to VAQ - ENCRYPTION METHOD
+5 ; file should be returned
+6 ; If 0, return method (default)
+7 ; If 1, return pointer to method
+8 ;OUTPUT : If method is requested
+9 ; The default encryption/decryption method
+10 ; NULL - Error
+11 ; If pointer is requested
+12 ; Pointer to VAQ - ENCRYPTION METHOD
+13 ; 0 - Error
+14 ;
+15 ;CHECK INPUT
+16 SET DCRYPT=+$GET(DCRYPT)
+17 SET POINT=+$GET(POINT)
+18 ;DECLARE VARIABLES
+19 NEW X,Y
+20 ;GET ENTRY IN PARAMTER FILE
+21 SET X=$ORDER(^VAT(394.81,0))
+22 ;COULDN'T FIND ENTRY IN PARAMETER
+23 if ('X)
QUIT ""
+24 ;GET POINTER TO METHOD
+25 SET Y=$GET(^VAT(394.81,X,"ECR"))
+26 SET Y=+$PIECE(Y,"^",2)
+27 ;POINTER TO METHOD DIDN'T EXIST
+28 if ('Y)
QUIT $SELECT(POINT:0,1:"")
+29 ;RETURN POINTER
+30 if (POINT)
QUIT Y
+31 ;RETURN METHOD
+32 QUIT $$ENCMTHD(Y,DCRYPT)