MAGGUJB ;WOIFO/GEK - Create file reference ; 20 Jan 2011 1:14 PM
;;3.0;IMAGING;**117**;Mar 19, 2002;Build 2238;Jul 15, 2011
;; 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
;***** Returns the Juke Box path to an image
; RPC: MAGG JUKE BOX PATH
;
; Input Parameters
; ================
; MAGIEN is IEN number in IMAGE file (#2005) or IMAGE AUDIT file (#2005.1)
;
; Return Values
; =============
; if error MAGRY = 0^error message
; if success MAGRY = 1^full juke box path
;
JB(MAGRY,MAGIEN) ; RPC [MAGG JUKE BOX PATH]
; RETURN THE PATH TO THE JB OF THE IMAGE... DELETED OR NOT.
N MAGFILE,MAGPREF,MAGSUFF,MAGFILE1
S MAGFILE=$$FILE^MAGGI11(MAGIEN)
I MAGFILE'>0 S MAGRY="0^Invalid IEN" Q ; problem getting file number
S (MAGPREF,MAGSUFF,MAGFILE1)=""
D FINDFILE
S MAGRY=MAGPREF_"^"_MAGFILE1
I MAGSUFF]"" S MAGRY=MAGRY_"^"_MAGSUFF
S MAGRY="1^"_MAGIEN_"^"_MAGRY
Q
;
FINDFILE ;
;;; NOTE : in Clinical Display application, we sometimes use the JB Path. If the
;;; Image Server is offline, or doesn't exist the JB path is returned.
;;; Then a JB Copy Queue is created so that the JB Copy of the image
;;; is put on RAID for quicker access next time.
;;; in 117 we always want to return the JB path, but we still need the tests for
;;; offline, invalid network location , etc.
N MAG0,MAGREF,MAGSTORE,MAGTYPE
S (MAGTYPE,MAGREF)=""
S MAG0=^MAG(MAGFILE,+MAGIEN,0)
S MAGFILE1=$P(MAG0,"^",2)
S MAGFILE1=$P(MAGFILE1,"\",$L(MAGFILE1,"\"))
;
S MAGREF=$P(MAG0,"^",5)
I MAGREF="" S MAGFILE1="-1~NO JUKEBOX LOCATION DEFINED" Q
I '$D(^MAG(2005.2,MAGREF,0)) S MAGFILE1="-1~INVALID NETWORK LOCATION POINTER ->"_MAGREF Q
S MAGSTORE=^MAG(2005.2,MAGREF,0)
S MAGTYPE=$P(MAGSTORE,"^",7)
I MAGTYPE="" S MAGTYPE=$E(MAGSTORE,1,4) ; in case the type is null
;
;; In case the JB is defined to be OffLine, we still want to return the path.
I '$P(MAGSTORE,"^",6) D ;jbox cartridge offline
. S MAGSUFF="JB Location: "_MAGREF_" is OFFLINE"
. Q
;
S MAGPREF=""
I MAGTYPE?1"WORM".E D ; code for Jukeboxes
. I MAGTYPE=("WORM-OTG") S MAGPREF=$P(MAGSTORE,"^",2)
. E I MAGTYPE="WORM-PDT" S MAGPREF=$P(MAGSTORE,"^",2)
. E I MAGTYPE["WORM-DG" D ; this code is for DG/SONY jukebox
. . N SUBDIR ; the subdirectory is the last two digits of the file name
. . S SUBDIR=$P(MAGFILE1,".")
. . S SUBDIR=$E(100+$E(SUBDIR,$L(SUBDIR)-1,999),2,3)_"\"
. . S MAGPREF=$P(MAGSTORE,"^",2)_SUBDIR
. . Q
. Q
S MAGPREF=MAGPREF_$$DIRHASH^MAGFILEB(MAGFILE1,MAGREF)
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGUJB 3517 printed Nov 22, 2024@17:13:49 Page 2
MAGGUJB ;WOIFO/GEK - Create file reference ; 20 Jan 2011 1:14 PM
+1 ;;3.0;IMAGING;**117**;Mar 19, 2002;Build 2238;Jul 15, 2011
+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 ;***** Returns the Juke Box path to an image
+19 ; RPC: MAGG JUKE BOX PATH
+20 ;
+21 ; Input Parameters
+22 ; ================
+23 ; MAGIEN is IEN number in IMAGE file (#2005) or IMAGE AUDIT file (#2005.1)
+24 ;
+25 ; Return Values
+26 ; =============
+27 ; if error MAGRY = 0^error message
+28 ; if success MAGRY = 1^full juke box path
+29 ;
JB(MAGRY,MAGIEN) ; RPC [MAGG JUKE BOX PATH]
+1 ; RETURN THE PATH TO THE JB OF THE IMAGE... DELETED OR NOT.
+2 NEW MAGFILE,MAGPREF,MAGSUFF,MAGFILE1
+3 SET MAGFILE=$$FILE^MAGGI11(MAGIEN)
+4 ; problem getting file number
IF MAGFILE'>0
SET MAGRY="0^Invalid IEN"
QUIT
+5 SET (MAGPREF,MAGSUFF,MAGFILE1)=""
+6 DO FINDFILE
+7 SET MAGRY=MAGPREF_"^"_MAGFILE1
+8 IF MAGSUFF]""
SET MAGRY=MAGRY_"^"_MAGSUFF
+9 SET MAGRY="1^"_MAGIEN_"^"_MAGRY
+10 QUIT
+11 ;
FINDFILE ;
+1 ;;; NOTE : in Clinical Display application, we sometimes use the JB Path. If the
+2 ;;; Image Server is offline, or doesn't exist the JB path is returned.
+3 ;;; Then a JB Copy Queue is created so that the JB Copy of the image
+4 ;;; is put on RAID for quicker access next time.
+5 ;;; in 117 we always want to return the JB path, but we still need the tests for
+6 ;;; offline, invalid network location , etc.
+7 NEW MAG0,MAGREF,MAGSTORE,MAGTYPE
+8 SET (MAGTYPE,MAGREF)=""
+9 SET MAG0=^MAG(MAGFILE,+MAGIEN,0)
+10 SET MAGFILE1=$PIECE(MAG0,"^",2)
+11 SET MAGFILE1=$PIECE(MAGFILE1,"\",$LENGTH(MAGFILE1,"\"))
+12 ;
+13 SET MAGREF=$PIECE(MAG0,"^",5)
+14 IF MAGREF=""
SET MAGFILE1="-1~NO JUKEBOX LOCATION DEFINED"
QUIT
+15 IF '$DATA(^MAG(2005.2,MAGREF,0))
SET MAGFILE1="-1~INVALID NETWORK LOCATION POINTER ->"_MAGREF
QUIT
+16 SET MAGSTORE=^MAG(2005.2,MAGREF,0)
+17 SET MAGTYPE=$PIECE(MAGSTORE,"^",7)
+18 ; in case the type is null
IF MAGTYPE=""
SET MAGTYPE=$EXTRACT(MAGSTORE,1,4)
+19 ;
+20 ;; In case the JB is defined to be OffLine, we still want to return the path.
+21 ;jbox cartridge offline
IF '$PIECE(MAGSTORE,"^",6)
Begin DoDot:1
+22 SET MAGSUFF="JB Location: "_MAGREF_" is OFFLINE"
+23 QUIT
End DoDot:1
+24 ;
+25 SET MAGPREF=""
+26 ; code for Jukeboxes
IF MAGTYPE?1"WORM".E
Begin DoDot:1
+27 IF MAGTYPE=("WORM-OTG")
SET MAGPREF=$PIECE(MAGSTORE,"^",2)
+28 IF '$TEST
IF MAGTYPE="WORM-PDT"
SET MAGPREF=$PIECE(MAGSTORE,"^",2)
+29 ; this code is for DG/SONY jukebox
IF '$TEST
IF MAGTYPE["WORM-DG"
Begin DoDot:2
+30 ; the subdirectory is the last two digits of the file name
NEW SUBDIR
+31 SET SUBDIR=$PIECE(MAGFILE1,".")
+32 SET SUBDIR=$EXTRACT(100+$EXTRACT(SUBDIR,$LENGTH(SUBDIR)-1,999),2,3)_"\"
+33 SET MAGPREF=$PIECE(MAGSTORE,"^",2)_SUBDIR
+34 QUIT
End DoDot:2
+35 QUIT
End DoDot:1
+36 SET MAGPREF=MAGPREF_$$DIRHASH^MAGFILEB(MAGFILE1,MAGREF)
+37 QUIT