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

MAGVRS45.m

Go to the documentation of this file.
  1. MAGVRS45 ;WOIFO/DAC,MLH - Utilities for RPC calls for DICOM file processing ; 19 Jan 2012 04:41 PM
  1. ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
  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. INPUTSEP() ; Name value separator for input data ie. NAME`TESTPATIENT
  1. Q "`"
  1. OUTSEP() ; Name value separator for output data ie. NAME|TESTPATIENT
  1. Q "|"
  1. STATSEP() ; Status and Result separator ie. -3``No record IEN
  1. Q "`"
  1. TRAVERSE(OUT,PFILENUM,IEN,DIR,CHILDIEN) ;utility - traverse a file
  1. N OSEP,ISEP,SSEP,RETIEN,FILE,STATFIELD,ACTIVE
  1. S OSEP=$$OUTSEP,ISEP=$$INPUTSEP,SSEP=$$STATSEP
  1. I "^0^1^2^3^4^"'[("^"_(PFILENUM-2005.6*100)_"^") D Q
  1. . S OUT(1)="-1"_SSEP_"Invalid file"
  1. . Q
  1. I ($G(IEN)'=+$G(IEN))!'IEN D Q
  1. . S OUT(1)="-2"_SSEP_"Invalid root IEN"
  1. . Q
  1. I '$D(^MAGV(PFILENUM,IEN)) D Q
  1. . S OUT(1)="-7"_SSEP_"IEN "_IEN_" not found in file "_PFILENUM
  1. . Q
  1. I ".FIRST.PREV.NEXT.LAST."'[("."_$TR(DIR,".")_".") D Q
  1. . S OUT(1)="-3"_SSEP_"Invalid direction"
  1. . Q
  1. I DIR'="PREV",DIR'="NEXT",$G(CHILDIEN) D Q
  1. . S OUT(1)="-4"_SSEP_"Child IEN not to be specified in command "_DIR
  1. . Q
  1. I DIR'="FIRST",DIR'="LAST",($G(CHILDIEN)'=+$G(CHILDIEN))!'$G(CHILDIEN) D Q
  1. . S OUT(1)="-5"_SSEP_"Invalid child IEN in command "_DIR
  1. . Q
  1. I $$GET1^DIQ(PFILENUM,IEN,$$GETFIELD^MAGVRS41(PFILENUM,"STATUS"),"I")'="A" D Q
  1. . S OUT(1)="-6"_SSEP_"Can't traverse children of inaccessible parent IEN "_IEN
  1. . Q
  1. S FILE=PFILENUM+.01
  1. I DIR'="FIRST",DIR'="LAST",'$D(^MAGV(FILE,"C",IEN,CHILDIEN)) D Q
  1. . S OUT(1)="-8"_SSEP_"Invalid child IEN in command "_DIR
  1. . Q
  1. S:DIR="FIRST" DIR="NEXT",CHILDIEN=""
  1. S:DIR="LAST" DIR="PREV",CHILDIEN=""
  1. S STATFIELD=$$GETFIELD^MAGVRS41(FILE,"STATUS")
  1. S RETIEN=CHILDIEN,ACTIVE=0
  1. F S RETIEN=$O(^MAGV(FILE,"C",IEN,RETIEN),$S(DIR="PREV":-1,1:1)) Q:'RETIEN D Q:ACTIVE
  1. . S ACTIVE=($$GET1^DIQ(FILE,RETIEN,STATFIELD,"I")="A")
  1. . Q
  1. S:RETIEN="" RETIEN=0
  1. S OUT(1)="0"_SSEP_SSEP_RETIEN
  1. Q