MAGUE006 ;WOIFO/MLH - IMAGING - utilities - ICN lookup ; 19-Jul-2013 3:44 PM
;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
;; Per VHA Directive 2004-038, this routine should not be modified.
;; +---------------------------------------------------------------+
;; | Property of the US Government. |
;; | No permission to copy or redistribute this software is given. |
;; | Use of unreleased versions of this software requires the user |
;; | to execute a written test agreement with the VistA Imaging |
;; | Development Office of the Department of Veterans Affairs, |
;; | telephone (301) 734-0100. |
;; | The Food and Drug Administration classifies this software as |
;; | a medical device. As such, it may not be changed in any way. |
;; | Modifications to this software may result in an adulterated |
;; | medical device under 21CFR820, the use of which is considered |
;; | to be a violation of US Federal Statutes. |
;; +---------------------------------------------------------------+
;;
Q ;
;
;+++++ GET ICN GIVEN DFN
;
; MAGDFN DFN of patient (internal entry number on PATIENT file (#2) )
;
; DELIM (optional) single punctuation character (e.g., comma (,))
; to which to change the up-arrow (^) delimiter returned
; by $$GETICN^MPIF001
;
; SUPPRESS (optional) set nonzero if error text only (no code) is desired
;
; RETURN VALUES
; =============
;
; OUTPUT Description
; ^01: -97 if invalid DELIM;
; else -98 if MAGDFN parameter missing;
; else -99 if no ICN (e.g., IHS);
; else -1 if ICN fetch raises exception;
; else ICN value
; ^02: "INVALID DELIMITER VALUE" if invalid DELIM;
; else "MAGDFN PARAMETER MISSING" if MAGDFN parameter missing;
; else "ICN NOT USED" if no ICN (e.g., IHS);
; else error message if ICN fetch raises exception;
; else empty
;
; Note: on exception, ^02 -> ^01 if code suppressed
;
GETICN(MAGDFN,DELIM,SUPPRESS) ;
N OUTPUT
D ; is ICN used / defined?
. I $D(DELIM)#10,DELIM'?1ANP D Q
. . S OUTPUT="-97^INVALID DELIMITER VALUE"
. . Q
. I $D(MAGDFN)#10=0 D Q
. . S OUTPUT="-98^MAGDFN PARAMETER MISSING"
. . Q
. I $T(GETICN^MPIF001)="" D Q
. . S OUTPUT="-99^ICN NOT USED"
. . Q
. S OUTPUT=$$GETICN^MPIF001(MAGDFN) ; Supported IA #2701
. S:OUTPUT="" OUTPUT="-1^ICN UNDEFINED"
. Q
I $D(DELIM)#10,DELIM?1ANP S OUTPUT=$TR(OUTPUT,"^",DELIM)
I $G(SUPPRESS),OUTPUT["^" S OUTPUT=$P(OUTPUT,"^",2)
Q $G(OUTPUT)
;
; MAGUE006
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGUE006 2933 printed Dec 13, 2024@02:08:53 Page 2
MAGUE006 ;WOIFO/MLH - IMAGING - utilities - ICN lookup ; 19-Jul-2013 3:44 PM
+1 ;;3.0;IMAGING;**138**;Mar 19, 2002;Build 5380;Sep 03, 2013
+2 ;; Per VHA Directive 2004-038, this routine should not be modified.
+3 ;; +---------------------------------------------------------------+
+4 ;; | Property of the US Government. |
+5 ;; | No permission to copy or redistribute this software is given. |
+6 ;; | Use of unreleased versions of this software requires the user |
+7 ;; | to execute a written test agreement with the VistA Imaging |
+8 ;; | Development Office of the Department of Veterans Affairs, |
+9 ;; | telephone (301) 734-0100. |
+10 ;; | The Food and Drug Administration classifies this software as |
+11 ;; | a medical device. As such, it may not be changed in any way. |
+12 ;; | Modifications to this software may result in an adulterated |
+13 ;; | medical device under 21CFR820, the use of which is considered |
+14 ;; | to be a violation of US Federal Statutes. |
+15 ;; +---------------------------------------------------------------+
+16 ;;
+17 ;
QUIT
+18 ;
+19 ;+++++ GET ICN GIVEN DFN
+20 ;
+21 ; MAGDFN DFN of patient (internal entry number on PATIENT file (#2) )
+22 ;
+23 ; DELIM (optional) single punctuation character (e.g., comma (,))
+24 ; to which to change the up-arrow (^) delimiter returned
+25 ; by $$GETICN^MPIF001
+26 ;
+27 ; SUPPRESS (optional) set nonzero if error text only (no code) is desired
+28 ;
+29 ; RETURN VALUES
+30 ; =============
+31 ;
+32 ; OUTPUT Description
+33 ; ^01: -97 if invalid DELIM;
+34 ; else -98 if MAGDFN parameter missing;
+35 ; else -99 if no ICN (e.g., IHS);
+36 ; else -1 if ICN fetch raises exception;
+37 ; else ICN value
+38 ; ^02: "INVALID DELIMITER VALUE" if invalid DELIM;
+39 ; else "MAGDFN PARAMETER MISSING" if MAGDFN parameter missing;
+40 ; else "ICN NOT USED" if no ICN (e.g., IHS);
+41 ; else error message if ICN fetch raises exception;
+42 ; else empty
+43 ;
+44 ; Note: on exception, ^02 -> ^01 if code suppressed
+45 ;
GETICN(MAGDFN,DELIM,SUPPRESS) ;
+1 NEW OUTPUT
+2 ; is ICN used / defined?
Begin DoDot:1
+3 IF $DATA(DELIM)#10
IF DELIM'?1ANP
Begin DoDot:2
+4 SET OUTPUT="-97^INVALID DELIMITER VALUE"
+5 QUIT
End DoDot:2
QUIT
+6 IF $DATA(MAGDFN)#10=0
Begin DoDot:2
+7 SET OUTPUT="-98^MAGDFN PARAMETER MISSING"
+8 QUIT
End DoDot:2
QUIT
+9 IF $TEXT(GETICN^MPIF001)=""
Begin DoDot:2
+10 SET OUTPUT="-99^ICN NOT USED"
+11 QUIT
End DoDot:2
QUIT
+12 ; Supported IA #2701
SET OUTPUT=$$GETICN^MPIF001(MAGDFN)
+13 if OUTPUT=""
SET OUTPUT="-1^ICN UNDEFINED"
+14 QUIT
End DoDot:1
+15 IF $DATA(DELIM)#10
IF DELIM?1ANP
SET OUTPUT=$TRANSLATE(OUTPUT,"^",DELIM)
+16 IF $GET(SUPPRESS)
IF OUTPUT["^"
SET OUTPUT=$PIECE(OUTPUT,"^",2)
+17 QUIT $GET(OUTPUT)
+18 ;
+19 ; MAGUE006