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

MAGUF.m

Go to the documentation of this file.
  1. MAGUF ;WOIFO/MLH - file utility routine ; 31 Dec 2009 5:53 PM
  1. ;;3.0;IMAGING;**98**;Mar 19, 2002;Build 1849;Sep 22, 2010
  1. ;; Per VHA Directive 2004-038, this routine should not be modified.
  1. ;; +---------------------------------------------------------------+
  1. ;; | Property of the US Government. |
  1. ;; | No permission to copy or redistribute this software is given. |
  1. ;; | Use of unreleased versions of this software requires the user |
  1. ;; | to execute a written test agreement with the VistA Imaging |
  1. ;; | Development Office of the Department of Veterans Affairs, |
  1. ;; | telephone (301) 734-0100. |
  1. ;; | The Food and Drug Administration classifies this software as |
  1. ;; | a medical device. As such, it may not be changed in any way. |
  1. ;; | Modifications to this software may result in an adulterated |
  1. ;; | medical device under 21CFR820, the use of which is considered |
  1. ;; | to be a violation of US Federal Statutes. |
  1. ;; +---------------------------------------------------------------+
  1. ;;
  1. Q
  1. ;
  1. NEARFMT(IMAGE,EXT) ; FUNCTION - return code for the format that's nearest
  1. ; This function lets the user know whether the nearest accessible version
  1. ; of the file associated with this image IEN is the magnetic or WORM
  1. ; version, or whether the image is stored offline.
  1. ;
  1. ; input: IMAGE file name or internal entry number on IMAGE File (#2005)
  1. ; EXT what file type is desired (ABS, BIG, FULL, or TXT)
  1. ;
  1. ; function return: code for nearest accessible version
  1. ; M = magnetic
  1. ; W = WORM
  1. ; O = offline
  1. ; I = invalid image number / no record found
  1. ; A = Image has been deleted / in archive file (#2005.1)
  1. ;
  1. N NEARCOD ; -- function return code for the nearest accessible version
  1. N IEN,TYPE,FILNAM,EXT,REC0,RECBIG
  1. ;
  1. S IEN="",NEARCOD="I" ; assume not valid
  1. I IMAGE'?1N.N D Q:('IEN)!(NEARCOD="A") NEARCOD
  1. . S FILNAM=$P(IMAGE,".") Q:FILNAM=""
  1. . I $D(^MAG(2005.1,"F",FILNAM)) S NEARCOD="A" Q
  1. . Q:'$D(^MAG(2005,"F",FILNAM))
  1. . S IEN=$O(^MAG(2005,"F",FILNAM,""))
  1. . Q
  1. E S IEN=IMAGE
  1. I $D(^MAG(2005.1,IEN)) S NEARCOD="A" Q NEARCOD
  1. S EXT=$S($D(EXT):EXT,$P($G(IMAGE),".",2):$P($G(IMAGE),".",2),1:"FULL")
  1. I $$PATCH^XPDUTL("MAG*3.0*39") S TYPE=$$FTYPE^MAGQBPRG(EXT,IEN) ;post P39
  1. E S TYPE=$$FTYPE^MAGQBPRG(EXT) ;pre P39
  1. D ;find applicable case, if any, and break
  1. . ; is the file on the OFFLINE IMAGES File?
  1. . N FNFULL ; -- full file name
  1. . S FNFULL=$P($G(^MAG(2005,IEN,0)),"^",2)
  1. . I FNFULL'="",$D(^MAGQUEUE(2006.033,"B",FNFULL)) S NEARCOD="O" Q
  1. . ; no, search for network location by file extension
  1. . I TYPE="ABS" D Q ;ABS has no independent worm reference
  1. . . S REC0=$G(^MAG(2005,IEN,0))
  1. . . I REC0="" S NEARCOD="I" Q
  1. . . I $P($G(^MAG(2005.2,+$P(REC0,"^",4),0)),"^",6) S NEARCOD="M" Q
  1. . . I $P($G(^MAG(2005.2,+$P(REC0,"^",5),0)),"^",6) S NEARCOD="W" Q
  1. . . S NEARCOD="O" Q
  1. . I (TYPE="FULL")!(TYPE="TXT") D Q ;txt has no independent reference
  1. . . S REC0=$G(^MAG(2005,IEN,0))
  1. . . I REC0="" S NEARCOD="I" Q
  1. . . I $P($G(^MAG(2005.2,+$P(REC0,"^",3),0)),"^",6) S NEARCOD="M" Q
  1. . . I $P($G(^MAG(2005.2,+$P(REC0,"^",5),0)),"^",6) S NEARCOD="W" Q
  1. . . S NEARCOD="O" Q
  1. . I TYPE="BIG" D Q
  1. . . S RECBIG=$G(^MAG(2005,IEN,"FBIG"))
  1. . . I RECBIG="" S NEARCOD="I" Q
  1. . . I $P($G(^MAG(2005.2,+$P(RECBIG,"^",1),0)),"^",6) S NEARCOD="M" Q
  1. . . I $P($G(^MAG(2005.2,+$P(RECBIG,"^",2),0)),"^",6) S NEARCOD="W" Q
  1. . . S NEARCOD="O" Q
  1. . Q
  1. Q NEARCOD