MAGGTIA ;WOIFO/GEK/RMP/NST - Imaging RPC Broker calls. Add/Modify Image entry ; 20 Dec 2010 3:16 PM
;;3.0;IMAGING;**8,48,106,117,99**;Mar 19, 2002;Build 2057;Apr 19, 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
;
;**** CALLING ROUTINE is responsible for RENAMING THE IMAGE FILE
;**** on DISK TO THE NEW FILE NAME RETURNED BY THIS CALL.
;
ADD(MAGRY,MAGGZ) ; RPC [MAGGADDIMAGE]
; Call to UPDATE^DIE to Add an Image File entry
; MAGGZ is an array of fields and their entries
; i.e. MAGGZ(1)=".5^38" Image File, field .5 data is 38
; If Long Description is included in fields, we create a new
; array to hold the text, and pass that to UPDATE^DIE
; If this entry is an object group
; i.e. MAGGZ(n)="2005.04^344"
; (the field 2005.04 is the OBJECT GROUP MULTIPLE)
;
; MAGRY - Ret variable (Single Variable)
;
; Changed to include hierarchical directory hash - PMK 04/23/98
; If successful MAGRY = IEN^FILE NAME (with full path)
; IEN is Internal Entry Number of ^MAG(2005
; If UNsuccessful MAGRY = 0^Error desc
;
; CALLING ROUTINE is responsible for RENAMING THE IMAGE FILE on DISK
; TO THE NEW FILE NAME RETURNED BY THIS CALL.
;----------------------------------------------------------------
N MAGGXE,MAGGFDA,MAGGIEN,MAGGDRV,MAGGR,MAGGRC,MAGGDA,MAGGFNM
N MAGGWP,MAGGWPC,MAGGFLD,MAGGDAT,MAGERR,MAGGEXT,MAGGJB
N MAGADD,MAGMOD,MAGWRITE,MAGREF,MAGDHASH,MAGDCMSN,MAGDCMIN
N MAGBIG,MAGGABS,MAGQY,MAGRET,MAGETXT
N MAGFSPEC,MAGFNM
N I,J,X,Y,Z,ZZ
;
N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
;
S MAGADD=1 ;Flag says we are adding an entry.
S MAGRY="0^Starting Add Image Entry"
S MAGERR="",MAGGR=0,MAGGRC=1,MAGGWPC=0
I ($D(MAGGZ)<10) S MAGRY="0^No input data, Operation CANCELED" Q
;
S Z="" F S Z=$O(MAGGZ(Z)) Q:Z="" D I $L(MAGERR) Q
. S MAGGFLD=$P(MAGGZ(Z),U,1),MAGGDAT=$P(MAGGZ(Z),U,2,99)
. I MAGGFLD=""!(MAGGDAT="") S MAGRY="0^Field and Value are Required" Q
. I MAGGFLD=5 S MAGGDAT=+MAGGDAT ; MOD RED 10/5/95
. I MAGGFLD=2005.04 S MAGGDAT=+MAGGDAT ; MOD RED 10/18/95
. I MAGGFLD="IEN" S MAGMOD=+MAGGDAT Q
. I MAGGFLD="EXT" S MAGGEXT=MAGGDAT Q
. I MAGGFLD="ABS" S MAGGABS=MAGGDAT Q
. I MAGGFLD="JB" S MAGGJB=MAGGDAT Q
. I MAGGFLD="WRITE" S MAGWRITE=MAGGDAT Q
. I MAGGFLD="BIG" S MAGBIG=MAGGDAT Q
. I MAGGFLD="DICOMSN" S MAGDCMSN=MAGGDAT Q
. I MAGGFLD="DICOMIN" S MAGDCMIN=MAGGDAT Q
. ;
. ; if this is a group object.
. I MAGGFLD=2005.04 D Q
. . S MAGGR=1
. . I '+MAGGDAT Q ; making a group entry, with no group entries.
. . S MAGGR(MAGGDAT)=""
. . S MAGGRC=MAGGRC+1
. . I '$D(^MAG(2005,MAGGDAT,0)) S MAGERR="0^Group Object "_MAGGDAT_" doesn't exist"
. . S MAGGFDA(2005.04,"+"_MAGGRC_",+1,",.01)=MAGGDAT
. ;
. ; if we are getting a WP for Long Desc, set array to pass.
. I MAGGFLD=11 D ; this is a line of the WP Long Desc field.
. . S MAGGWPC=MAGGWPC+1,MAGGWP(MAGGWPC)=MAGGDAT
. ;
. ;if a BAD field number
. I '$$VFIELD^DILFD(2005,MAGGFLD) S MAGERR="0^Field Number "_MAGGFLD_" doesn't exist" Q
. ;
. ; Get Field Specifiers
. D FIELD^DID(2005,MAGGFLD,"","LABEL;SPECIFIER","MAGFSPEC")
. ; if a Date field, we'll convert it here.
. I (MAGFSPEC("SPECIFIER")["D") D Q:$L(MAGERR)
. . S %DT="T",X=MAGGDAT D ^%DT
. . I Y=-1 S MAGERR="0^Invalid Date: "_MAGGDAT_" Field: "_MAGFSPEC("LABEL") Q
. . S MAGGDAT=Y
. ;
. ; if a pointer field, we'll assure the pointed to entry exists.
. I (MAGFSPEC("SPECIFIER")["P") D Q:$L(MAGERR)
. . I ($$EXTERNAL^DILFD(2005,MAGGFLD,"",MAGGDAT)="") S MAGERR="0^Invalid Value for Field "_MAGFSPEC("LABEL") Q
. ;
. I (MAGFSPEC("SPECIFIER")["S") D Q:$L(MAGERR)
. . D VAL^DIE(2005,"",MAGGFLD,"",MAGGDAT,.MAGRET,"","MAGETXT") I MAGRET="^" D Q
. . . S MAGERR="0^"_MAGETXT("DIERR",1,"TEXT",1)
. . ;P48T1 This assures we are filing the Internal code for a set.
. . S MAGGDAT=MAGRET
. ;
. ; made it here, so set the Node for the UPDATE^DIC Call.
. S MAGGFDA(2005,"+1,",MAGGFLD)=MAGGDAT
;
; if there was an Error in data we'll quit now.
I $L(MAGERR) S MAGRY=MAGERR Q
I $D(MAGMOD) D
. I $D(MAGGWP) S MAGGFDA(2005,"+1,",11)="MAGGWP"
. S MAGMOD=MAGMOD_","
. M MAGXXX(2005,MAGMOD)=MAGGFDA(2005,"+1,") K MAGGFDA
. M MAGGFDA=MAGXXX K MAGXXX
I $D(MAGMOD) D ADD^MAGGTIA1 Q
;
; some possible problems, we'll check for now.
I '$D(MAGGFDA(2005,"+1,")) S MAGRY="0^No data to file Operation CANCELED " Q
;
; Patch 106: For VI Capture and DICOM Gateway the value of #8.1 is set
; here if it is not send. For Imort API see PRE^MAGGSIA1
I '$D(MAGGFDA(2005,"+1,",8.1)) D
. ; PACS UID (#60); RADIOLOGY REPORT (#61); PACS PROCEDURE (#62)
. I $D(MAGGFDA(2005,"+1,",60))!$D(MAGGFDA(2005,"+1,",61))!$D(MAGGFDA(2005,"+1,",62)) S MAGGFDA(2005,"+1,",8.1)="D" Q
. I $D(MAGGFDA(2005,"+1,",108)) S MAGGFDA(2005,"+1,",8.1)="I" Q ; TRACKING ID (#108)
. S MAGGFDA(2005,"+1,",8.1)="C"
. Q
;
S:$G(MAGGFDA(2005,"+1,",113))="" MAGGFDA(2005,"+1,",113)=1 ; Patch 117: Set STATUS field (#113) to Viewable (1)
; We're making Object Type and either Patient, or short Desc Required.
I '$D(MAGGFDA(2005,"+1,",3)) S MAGRY="0^Need an Object Type " Q
; Change to require patient. not patient or short desc.
I '$D(MAGGFDA(2005,"+1,",5)) D Q
. S MAGRY="0^Need Patient. Operation CANCELED "
; MAGQA check.
D QACHK^MAGGTIA2(.MAGQY,MAGGFDA(2005,"+1,",5),$G(MAGGFDA(2005,"+1,",16)),$G(MAGGFDA(2005,"+1,",17)))
I 'MAGQY S MAGRY=MAGQY Q
;-Checking for a missing TYPE value, and generating a value if needed
;- are being deferred to a later patch.
; Check for Image TYPE #42
;-I '$D(MAGGFDA(2005,"+1,",42)) D MAKETYPE^MAGGSIA1 I $L(MAGERR) S MAGRY=MAGERR Q
; Check for Image Class, #41
I '$D(MAGGFDA(2005,"+1,",41)) D MAKECLAS^MAGGSIU1 I $L(MAGERR) S MAGRY=MAGERR Q
; IF no Procedure text we'll give it some so crossref will set.
I '$D(MAGGFDA(2005,"+1,",6)) S MAGGFDA(2005,"+1,",6)="NO TEXT"
; If no Procedure/Exam Date/Time we'll give it NOW
I '$D(MAGGFDA(2005,"+1,",15)) S MAGGFDA(2005,"+1,",15)=$$NOW^XLFDT
; DateTime image saved.
I '$D(MAGGFDA(2005,"+1,",7)) S MAGGFDA(2005,"+1,",7)=$$NOW^XLFDT
; If no INSTITUTION pointer then default to the DUZ(2) or the Kernel Site parameter file institution
I '$D(MAGGFDA(2005,"+1,",.05)) D
. I $D(DUZ(2)) S MAGGFDA(2005,"+1,",.05)=DUZ(2) Q
. ;Q:$T(KSP^XUPARAM)="" //GEK 4/15/2004 Not needed on Gateway anymore
. S MAGGFDA(2005,"+1,",.05)=$$KSP^XUPARAM("INST")
. Q
;
I '$D(MAGGFDA(2005,"+1,",10)) S MAGGFDA(2005,"+1,",10)=$$MAKENAME^MAGGTIA1()
; Only get drive:dir if not a group
I 'MAGGR D I $L(MAGERR) S MAGRY=MAGERR Q
. S X=$S($D(MAGGFDA(2005,"+1,",2)):MAGGFDA(2005,"+1,",2),1:"")
. S Z=$$DRIVE^MAGGTU1(X) ;Drv:Dir to Write
. I 'Z S MAGERR=Z Q
. S MAGGDRV=$P(Z,U,2)
. S MAGGFDA(2005,"+1,",2)=+Z ;Disk & Vol magnetic
. ; if a big file is being made on workstation, put NetWork Location
. ; pointer in the BIG NETWORK LOCATION field.
. ; (BIG files default to same Network Location as FullRes (or PACS))
. I ($P($G(MAGBIG),U,1))=1 D
. . S MAGGFDA(2005,"+1,",102)=+Z
. . S MAGGFDA(2005,"+1,",104)=$P(MAGBIG,U,2)
. . Q
. S MAGREF=+Z ; save network location ien for $$DIRHASH in ^MAGGTIA1
. I $G(MAGGABS)="STUFFONLY" S MAGGFDA(2005,"+1,",2.1)=+Z
;
; If a Name (.01) wasn't sent, we'll make one
; We know that either Patient or Short Desc, and Object Type exist
I '$D(MAGGFDA(2005,"+1,",.01)) S MAGGFDA(2005,"+1,",.01)=$$MAKENAME^MAGGTIA1()
;
; If a long description was sent.
I $D(MAGGWP) S MAGGFDA(2005,"+1,",11)="MAGGWP"
;
D ADD^MAGGTIA1 ; continued
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGGTIA 8620 printed Dec 13, 2024@02:02:58 Page 2
MAGGTIA ;WOIFO/GEK/RMP/NST - Imaging RPC Broker calls. Add/Modify Image entry ; 20 Dec 2010 3:16 PM
+1 ;;3.0;IMAGING;**8,48,106,117,99**;Mar 19, 2002;Build 2057;Apr 19, 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 ;
+19 ;**** CALLING ROUTINE is responsible for RENAMING THE IMAGE FILE
+20 ;**** on DISK TO THE NEW FILE NAME RETURNED BY THIS CALL.
+21 ;
ADD(MAGRY,MAGGZ) ; RPC [MAGGADDIMAGE]
+1 ; Call to UPDATE^DIE to Add an Image File entry
+2 ; MAGGZ is an array of fields and their entries
+3 ; i.e. MAGGZ(1)=".5^38" Image File, field .5 data is 38
+4 ; If Long Description is included in fields, we create a new
+5 ; array to hold the text, and pass that to UPDATE^DIE
+6 ; If this entry is an object group
+7 ; i.e. MAGGZ(n)="2005.04^344"
+8 ; (the field 2005.04 is the OBJECT GROUP MULTIPLE)
+9 ;
+10 ; MAGRY - Ret variable (Single Variable)
+11 ;
+12 ; Changed to include hierarchical directory hash - PMK 04/23/98
+13 ; If successful MAGRY = IEN^FILE NAME (with full path)
+14 ; IEN is Internal Entry Number of ^MAG(2005
+15 ; If UNsuccessful MAGRY = 0^Error desc
+16 ;
+17 ; CALLING ROUTINE is responsible for RENAMING THE IMAGE FILE on DISK
+18 ; TO THE NEW FILE NAME RETURNED BY THIS CALL.
+19 ;----------------------------------------------------------------
+20 NEW MAGGXE,MAGGFDA,MAGGIEN,MAGGDRV,MAGGR,MAGGRC,MAGGDA,MAGGFNM
+21 NEW MAGGWP,MAGGWPC,MAGGFLD,MAGGDAT,MAGERR,MAGGEXT,MAGGJB
+22 NEW MAGADD,MAGMOD,MAGWRITE,MAGREF,MAGDHASH,MAGDCMSN,MAGDCMIN
+23 NEW MAGBIG,MAGGABS,MAGQY,MAGRET,MAGETXT
+24 NEW MAGFSPEC,MAGFNM
+25 NEW I,J,X,Y,Z,ZZ
+26 ;
+27 NEW $ETRAP,$ESTACK
SET $ETRAP="D ERR^MAGGTERR"
+28 ;
+29 ;Flag says we are adding an entry.
SET MAGADD=1
+30 SET MAGRY="0^Starting Add Image Entry"
+31 SET MAGERR=""
SET MAGGR=0
SET MAGGRC=1
SET MAGGWPC=0
+32 IF ($DATA(MAGGZ)<10)
SET MAGRY="0^No input data, Operation CANCELED"
QUIT
+33 ;
+34 SET Z=""
FOR
SET Z=$ORDER(MAGGZ(Z))
if Z=""
QUIT
Begin DoDot:1
+35 SET MAGGFLD=$PIECE(MAGGZ(Z),U,1)
SET MAGGDAT=$PIECE(MAGGZ(Z),U,2,99)
+36 IF MAGGFLD=""!(MAGGDAT="")
SET MAGRY="0^Field and Value are Required"
QUIT
+37 ; MOD RED 10/5/95
IF MAGGFLD=5
SET MAGGDAT=+MAGGDAT
+38 ; MOD RED 10/18/95
IF MAGGFLD=2005.04
SET MAGGDAT=+MAGGDAT
+39 IF MAGGFLD="IEN"
SET MAGMOD=+MAGGDAT
QUIT
+40 IF MAGGFLD="EXT"
SET MAGGEXT=MAGGDAT
QUIT
+41 IF MAGGFLD="ABS"
SET MAGGABS=MAGGDAT
QUIT
+42 IF MAGGFLD="JB"
SET MAGGJB=MAGGDAT
QUIT
+43 IF MAGGFLD="WRITE"
SET MAGWRITE=MAGGDAT
QUIT
+44 IF MAGGFLD="BIG"
SET MAGBIG=MAGGDAT
QUIT
+45 IF MAGGFLD="DICOMSN"
SET MAGDCMSN=MAGGDAT
QUIT
+46 IF MAGGFLD="DICOMIN"
SET MAGDCMIN=MAGGDAT
QUIT
+47 ;
+48 ; if this is a group object.
+49 IF MAGGFLD=2005.04
Begin DoDot:2
+50 SET MAGGR=1
+51 ; making a group entry, with no group entries.
IF '+MAGGDAT
QUIT
+52 SET MAGGR(MAGGDAT)=""
+53 SET MAGGRC=MAGGRC+1
+54 IF '$DATA(^MAG(2005,MAGGDAT,0))
SET MAGERR="0^Group Object "_MAGGDAT_" doesn't exist"
+55 SET MAGGFDA(2005.04,"+"_MAGGRC_",+1,",.01)=MAGGDAT
End DoDot:2
QUIT
+56 ;
+57 ; if we are getting a WP for Long Desc, set array to pass.
+58 ; this is a line of the WP Long Desc field.
IF MAGGFLD=11
Begin DoDot:2
+59 SET MAGGWPC=MAGGWPC+1
SET MAGGWP(MAGGWPC)=MAGGDAT
End DoDot:2
+60 ;
+61 ;if a BAD field number
+62 IF '$$VFIELD^DILFD(2005,MAGGFLD)
SET MAGERR="0^Field Number "_MAGGFLD_" doesn't exist"
QUIT
+63 ;
+64 ; Get Field Specifiers
+65 DO FIELD^DID(2005,MAGGFLD,"","LABEL;SPECIFIER","MAGFSPEC")
+66 ; if a Date field, we'll convert it here.
+67 IF (MAGFSPEC("SPECIFIER")["D")
Begin DoDot:2
+68 SET %DT="T"
SET X=MAGGDAT
DO ^%DT
+69 IF Y=-1
SET MAGERR="0^Invalid Date: "_MAGGDAT_" Field: "_MAGFSPEC("LABEL")
QUIT
+70 SET MAGGDAT=Y
End DoDot:2
if $LENGTH(MAGERR)
QUIT
+71 ;
+72 ; if a pointer field, we'll assure the pointed to entry exists.
+73 IF (MAGFSPEC("SPECIFIER")["P")
Begin DoDot:2
+74 IF ($$EXTERNAL^DILFD(2005,MAGGFLD,"",MAGGDAT)="")
SET MAGERR="0^Invalid Value for Field "_MAGFSPEC("LABEL")
QUIT
End DoDot:2
if $LENGTH(MAGERR)
QUIT
+75 ;
+76 IF (MAGFSPEC("SPECIFIER")["S")
Begin DoDot:2
+77 DO VAL^DIE(2005,"",MAGGFLD,"",MAGGDAT,.MAGRET,"","MAGETXT")
IF MAGRET="^"
Begin DoDot:3
+78 SET MAGERR="0^"_MAGETXT("DIERR",1,"TEXT",1)
End DoDot:3
QUIT
+79 ;P48T1 This assures we are filing the Internal code for a set.
+80 SET MAGGDAT=MAGRET
End DoDot:2
if $LENGTH(MAGERR)
QUIT
+81 ;
+82 ; made it here, so set the Node for the UPDATE^DIC Call.
+83 SET MAGGFDA(2005,"+1,",MAGGFLD)=MAGGDAT
End DoDot:1
IF $LENGTH(MAGERR)
QUIT
+84 ;
+85 ; if there was an Error in data we'll quit now.
+86 IF $LENGTH(MAGERR)
SET MAGRY=MAGERR
QUIT
+87 IF $DATA(MAGMOD)
Begin DoDot:1
+88 IF $DATA(MAGGWP)
SET MAGGFDA(2005,"+1,",11)="MAGGWP"
+89 SET MAGMOD=MAGMOD_","
+90 MERGE MAGXXX(2005,MAGMOD)=MAGGFDA(2005,"+1,")
KILL MAGGFDA
+91 MERGE MAGGFDA=MAGXXX
KILL MAGXXX
End DoDot:1
+92 IF $DATA(MAGMOD)
DO ADD^MAGGTIA1
QUIT
+93 ;
+94 ; some possible problems, we'll check for now.
+95 IF '$DATA(MAGGFDA(2005,"+1,"))
SET MAGRY="0^No data to file Operation CANCELED "
QUIT
+96 ;
+97 ; Patch 106: For VI Capture and DICOM Gateway the value of #8.1 is set
+98 ; here if it is not send. For Imort API see PRE^MAGGSIA1
+99 IF '$DATA(MAGGFDA(2005,"+1,",8.1))
Begin DoDot:1
+100 ; PACS UID (#60); RADIOLOGY REPORT (#61); PACS PROCEDURE (#62)
+101 IF $DATA(MAGGFDA(2005,"+1,",60))!$DATA(MAGGFDA(2005,"+1,",61))!$DATA(MAGGFDA(2005,"+1,",62))
SET MAGGFDA(2005,"+1,",8.1)="D"
QUIT
+102 ; TRACKING ID (#108)
IF $DATA(MAGGFDA(2005,"+1,",108))
SET MAGGFDA(2005,"+1,",8.1)="I"
QUIT
+103 SET MAGGFDA(2005,"+1,",8.1)="C"
+104 QUIT
End DoDot:1
+105 ;
+106 ; Patch 117: Set STATUS field (#113) to Viewable (1)
if $GET(MAGGFDA(2005,"+1,",113))=""
SET MAGGFDA(2005,"+1,",113)=1
+107 ; We're making Object Type and either Patient, or short Desc Required.
+108 IF '$DATA(MAGGFDA(2005,"+1,",3))
SET MAGRY="0^Need an Object Type "
QUIT
+109 ; Change to require patient. not patient or short desc.
+110 IF '$DATA(MAGGFDA(2005,"+1,",5))
Begin DoDot:1
+111 SET MAGRY="0^Need Patient. Operation CANCELED "
End DoDot:1
QUIT
+112 ; MAGQA check.
+113 DO QACHK^MAGGTIA2(.MAGQY,MAGGFDA(2005,"+1,",5),$GET(MAGGFDA(2005,"+1,",16)),$GET(MAGGFDA(2005,"+1,",17)))
+114 IF 'MAGQY
SET MAGRY=MAGQY
QUIT
+115 ;-Checking for a missing TYPE value, and generating a value if needed
+116 ;- are being deferred to a later patch.
+117 ; Check for Image TYPE #42
+118 ;-I '$D(MAGGFDA(2005,"+1,",42)) D MAKETYPE^MAGGSIA1 I $L(MAGERR) S MAGRY=MAGERR Q
+119 ; Check for Image Class, #41
+120 IF '$DATA(MAGGFDA(2005,"+1,",41))
DO MAKECLAS^MAGGSIU1
IF $LENGTH(MAGERR)
SET MAGRY=MAGERR
QUIT
+121 ; IF no Procedure text we'll give it some so crossref will set.
+122 IF '$DATA(MAGGFDA(2005,"+1,",6))
SET MAGGFDA(2005,"+1,",6)="NO TEXT"
+123 ; If no Procedure/Exam Date/Time we'll give it NOW
+124 IF '$DATA(MAGGFDA(2005,"+1,",15))
SET MAGGFDA(2005,"+1,",15)=$$NOW^XLFDT
+125 ; DateTime image saved.
+126 IF '$DATA(MAGGFDA(2005,"+1,",7))
SET MAGGFDA(2005,"+1,",7)=$$NOW^XLFDT
+127 ; If no INSTITUTION pointer then default to the DUZ(2) or the Kernel Site parameter file institution
+128 IF '$DATA(MAGGFDA(2005,"+1,",.05))
Begin DoDot:1
+129 IF $DATA(DUZ(2))
SET MAGGFDA(2005,"+1,",.05)=DUZ(2)
QUIT
+130 ;Q:$T(KSP^XUPARAM)="" //GEK 4/15/2004 Not needed on Gateway anymore
+131 SET MAGGFDA(2005,"+1,",.05)=$$KSP^XUPARAM("INST")
+132 QUIT
End DoDot:1
+133 ;
+134 IF '$DATA(MAGGFDA(2005,"+1,",10))
SET MAGGFDA(2005,"+1,",10)=$$MAKENAME^MAGGTIA1()
+135 ; Only get drive:dir if not a group
+136 IF 'MAGGR
Begin DoDot:1
+137 SET X=$SELECT($DATA(MAGGFDA(2005,"+1,",2)):MAGGFDA(2005,"+1,",2),1:"")
+138 ;Drv:Dir to Write
SET Z=$$DRIVE^MAGGTU1(X)
+139 IF 'Z
SET MAGERR=Z
QUIT
+140 SET MAGGDRV=$PIECE(Z,U,2)
+141 ;Disk & Vol magnetic
SET MAGGFDA(2005,"+1,",2)=+Z
+142 ; if a big file is being made on workstation, put NetWork Location
+143 ; pointer in the BIG NETWORK LOCATION field.
+144 ; (BIG files default to same Network Location as FullRes (or PACS))
+145 IF ($PIECE($GET(MAGBIG),U,1))=1
Begin DoDot:2
+146 SET MAGGFDA(2005,"+1,",102)=+Z
+147 SET MAGGFDA(2005,"+1,",104)=$PIECE(MAGBIG,U,2)
+148 QUIT
End DoDot:2
+149 ; save network location ien for $$DIRHASH in ^MAGGTIA1
SET MAGREF=+Z
+150 IF $GET(MAGGABS)="STUFFONLY"
SET MAGGFDA(2005,"+1,",2.1)=+Z
End DoDot:1
IF $LENGTH(MAGERR)
SET MAGRY=MAGERR
QUIT
+151 ;
+152 ; If a Name (.01) wasn't sent, we'll make one
+153 ; We know that either Patient or Short Desc, and Object Type exist
+154 IF '$DATA(MAGGFDA(2005,"+1,",.01))
SET MAGGFDA(2005,"+1,",.01)=$$MAKENAME^MAGGTIA1()
+155 ;
+156 ; If a long description was sent.
+157 IF $DATA(MAGGWP)
SET MAGGFDA(2005,"+1,",11)="MAGGWP"
+158 ;
+159 ; continued
DO ADD^MAGGTIA1
+160 QUIT