MAGIPS93 ;WOIFO/SG - INSTALL CODE FOR MAG*3*93 ; 5/13/09 10:01am
;;3.0;IMAGING;**93**;Dec 02, 2009;Build 163
;; 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. |
;; +---------------------------------------------------------------+
;
; There are no environment checks here but the MAGIPS93 has to be
; referenced by the "Environment Check Routine" field of the KIDS
; build so that entry points of the routine are available to the
; KIDS during all installation phases.
Q
;
;+++++ INSTALLATION ERROR HANDLING
ERROR ;
S:$D(XPDNM) XPDABORT=1
;--- Display the messages and store them to the INSTALL file
D DUMP^MAGUERR1(),ABTMSG^MAGKIDS()
Q
;
;+++++ UPDATES/FIXES THE DELETED IMAGE ENTRY
;
; MAGIEN IEN of an entry of the IMAGE AUDIT file (#2005.1)
;
; Input Variables
; ===============
; MAGSTAT
;
; Return Values
; =============
; <0 Error descriptor (see the $$ERROR^MAGUERR)
; 0 Ok
;
MAGAUDIT(MAGIEN) ;
N MAGNODE,MAGRC,STC,SUB,TMP
S MAGNODE=$NA(^MAG(2005.1,MAGIEN))
Q:$D(@MAGNODE)<10 $$ERROR^MAGUERR(-22,,2005.1,MAGIEN_",")
S STC=$P($G(@MAGNODE@(100)),U,8) Q:STC=12 0 ; STATUS (113)
S MAGRC=0
;
;=== Fix the subfile headers
F SUB="1^2005.14P","4^2005.1106DA","5^2005.11PA","6^2005.1111A","99^2005.199D" D
. S TMP=$P(SUB,U) Q:'($D(^MAG(2005.1,MAGIEN,TMP,0))#2)
. S $P(^MAG(2005.1,MAGIEN,TMP,0),U,2)=$P(SUB,U,2)
. Q
;
;=== Update STATUS field and create the corresponding audit record
S TMP=+$P($G(@MAGNODE@(30)),U,2) ; DELETED DATE (30.1)
I TMP>0 D Q:MAGRC<0 MAGRC
. N IENS,MAGFDA,MAGMSG
. S IENS="+1,"_MAGIEN_","
. S MAGFDA(2005.199,IENS,.01)=TMP ; DATE/TIME RECORDED
. S MAGFDA(2005.199,IENS,.02)=113 ; FIELD NUMBER
. ;--- USER = DELETED BY (30)
. S MAGFDA(2005.199,IENS,.03)=$P($G(@MAGNODE@(30)),U)
. ;--- OLD INTERNAL VALUE and OLD EXTERNAL VALUE
. D:STC>0
. . S MAGFDA(2005.199,IENS,1)=STC
. . S:$G(MAGSTAT(STC))'="" MAGFDA(2005.199,IENS,2)=MAGSTAT(STC)
. . Q
. ;--- Create audit record for the status update
. D UPDATE^DIE(,"MAGFDA",,"MAGMSG")
. S:$G(DIERR) MAGRC=$$DBS^MAGUERR("MAGMSG",2005.1,MAGIEN_",")
. Q
S $P(@MAGNODE@(100),U,8)=12 ; STATUS = 'Deleted'
;
;===
Q MAGRC
;
;+++++ BUILDS NEW INDEXES IN FILES #2005 AND #2005.1
;
; MAGSUSPEND Task suspension parameters
; ^01: Suspend the task (0|1)
; ^02: Suspension start time (e.g. 7am: .07)
; ^03: Suspension end time (e.g. 8pm: .2)
;
; Input Variables
; ===============
; XPDNM, ZTQUEUED
;
; Return Values
; =============
; <0 Error descriptor (see the $$ERROR^MAGUERR)
; 0 Ok
;
; Notes
; =====
;
; This function also populates the STATUS field (113) and fixes
; headers of all multiples of the IMAGE AUDIT file (#2005.1).
;
NDXBLD(MAGSUSPEND) ;
N MAGFILE ; Number of the file that is being processed
N MAGNOFMAUDIT ; Controls image audit indexes (see AUDIT^MAGUXRF)
N MAGROOT ; Closed root of the file that is being processed
N MAGSTAT ; List of status codes and their descriptions
;
N DTNEXT,MAGCNT,MAGIEN,MAGRC,SILENT,TH,TMP
S SILENT=$S($G(XPDNM)'="":0,1:$D(ZTQUEUED)),MAGRC=0
D:'SILENT BMES^MAGKIDS("Building new image indexes...")
;
;=== Get the image status codes
D
. N BUF,I
. S BUF=$$GET1^DID(2005,113,,"POINTER")
. F I=1:1 S TMP=$P(BUF,";",I) Q:TMP="" D
. . S MAGSTAT(+TMP)=$P(TMP,":",2)
. . Q
. Q
;
;=== Do not update the AUDIT multiple (99)
S MAGNOFMAUDIT=1
;
;=== Build the indexes
F MAGFILE=2005,2005.1 D Q:MAGRC<0
. I 'SILENT D D MES^MAGKIDS(TMP_" file (#"_MAGFILE_")")
. . S TMP=$$GET1^DID(MAGFILE,,,"NAME")
. . Q
. ;--- Check if the file has been processed already
. I $$PRD^MAGKIDS(MAGFILE,93) D:'SILENT Q
. . D MES^MAGKIDS("This file is already processed.")
. . Q
. ;--- Initialize
. S XPDIDTOT=$$GET1^DID(MAGFILE,,,"ENTRIES")
. I XPDIDTOT'>0 D:'SILENT MES^MAGKIDS("This file is empty.") Q
. S MAGROOT=$$ROOT^DILFD(MAGFILE,,1),DIK=$$OREF^DILF(MAGROOT)
. ;--- Delete the indexes (in case of restart)
. K @MAGROOT@("APDT")
. K:MAGFILE=2005.1 @MAGROOT@("AGP"),^("APDTPX")
. ;--- Process the file
. S (MAGCNT,MAGIEN)=0
. F S MAGIEN=$O(@MAGROOT@(MAGIEN)) Q:'MAGIEN D Q:MAGRC<0
. . I '(MAGCNT#1000) D Q:MAGRC<0
. . . I '$D(ZTQUEUED) D PROGRESS(MAGCNT) Q
. . . ;--- Check if task stop has been requested
. . . I $$S^%ZTLOAD S MAGRC=$$ERROR^MAGUERR(-1) Q
. . . ;--- Check if the task should be suspended
. . . Q:'$G(MAGSUSPEND)
. . . Q:$$NOW^XLFDT<$G(DTNEXT)
. . . Q:'$$SUSPEND(.DTNEXT)
. . . ;--- Suspend the task during the peak hours
. . . F D Q:'TH!MAGRC<0
. . . . S TH=$$FMDIFF^XLFDT(DTNEXT,$$NOW^XLFDT,2)
. . . . I TH<60 S TH=0 Q ; Do not HANG for less than a
. . . . H $S(TH>3600:3600,1:TH) ; minute and more than an hour
. . . . ;--- Check if task stop has been requested
. . . . S:$$S^%ZTLOAD MAGRC=$$ERROR^MAGUERR(-1)
. . . . Q
. . . Q
. . S MAGCNT=MAGCNT+1
. . ;--- Additional processing for IMAGE AUDIT record
. . I MAGFILE=2005.1 S MAGRC=$$MAGAUDIT(MAGIEN) Q:MAGRC<0
. . ;--- Re-index the record
. . D XREF(MAGFILE,MAGIEN)
. . Q
. ;--- Indicate the final state of the process
. D:'$D(ZTQUEUED) PROGRESS(MAGCNT)
. D PRD^MAGKIDS(MAGFILE,93,"A")
. Q
Q:MAGRC<0 MAGRC
;
;=== Success
D:'SILENT MES^MAGKIDS("The indexes have been successfully built.")
Q 0
;
;+++++ CALLBACK FUNCTION FOR THE IMGAGE INDEX CHECKPOINT
;
; Input Variables
; ===============
; DUZ, XPDQUES, ZTQUEUED
;
NDXCP() ;
N MAGRC
S MAGRC=0
;
;=== Schedule a separate task that will build image indexes
I $G(XPDQUES("POS02-MODE")) D Q MAGRC
. N MSG,ZTCPU,ZTDESC,ZTDTH,ZTIO,ZTKIL,ZTPRI
. N ZTRTN,ZTSAVE,ZTSK,ZTSYNC,ZTUCI
. S ZTSAVE("MAGDUZ")=$G(DUZ)
. S:$G(XPDQUES("POS10-SUSPEND")) ZTSAVE("MAGSUSPEND")="1^.07^.2"
. S ZTRTN="NDXTASK^"_$T(+0),ZTIO=""
. S ZTDESC="Image index builder (MAG*3*93)"
. S ZTDTH=$G(XPDQUES("POS05-SCHEDULEAT"))
. S:ZTDTH'>0 ZTDTH=$$NOW^XLFDT
. D ^%ZTLOAD
. I $G(ZTSK)="" S MAGRC=$$ERROR^MAGUERR(-39) Q
. ;--- Display the confirmation message
. S MSG(1)="It will rebuild indexes in the IMAGE (#2005) and IMAGE AUDIT (#2005.1)"
. S MSG(2)="files and perform other post-processing actions."
. D BMES^MAGKIDS("Task #"_ZTSK_" has been scheduled.",.MSG)
. Q
;
;=== Build the indexes as part of the patch post-install
Q $$NDXBLD()
;
;***** FORMATS AND PRINTS THE HELP TEXT FOR THE INDEX TASK MODE
NDXHLP(DIR,KIDS) ;
;;Patch MAG*3*93 defines new indexes for the IMAGE (#2005) and IMAGE
;;AUDIT (#2005.1) files. These indexes can be built as a part of the
;;patch KIDS build installation or the post-install code can schedule
;;a separate task that will build the indexes.
;;
;;However, it appears that the Taskman is not running on this system.
;;As the result, you will not be given a choice and the indexes will
;;be built as part of the post-install. If you want to schedule a
;;separate indexing task, abort the installation, start the Taskman,
;;and restart the patch installation.
NDXHLP1 ;
;;Patch MAG*3*93 defines new indexes for the IMAGE (#2005) and IMAGE
;;AUDIT (#2005.1) files. These indexes can be built in the current
;;session (this will block it for quite a long time) or a separate
;;task can be scheduled.
;;
;;However, it appears that the Taskman is not running on this system.
;;If you want to schedule a separate indexing task, exit this option,
;;start the Taskman, and run the option again.
;
N DIWF,DIWL,DIWR,MAGI,MAGTAG,X
S MAGTAG=$S($G(KIDS):"NDXHLP",1:"NDXHLP1")
S DIWF="",DIWL=4,DIWR=$G(IOM,80)-DIWL+1
K ^UTILITY($J,"W"),DIR("?")
;--- Format the main help text
F MAGI=1:1 S X=$P($T(@MAGTAG+MAGI),";;",2) Q:X="" D ^DIWP
S X=" " D ^DIWP
;--- Add the warning if the Taskman is not running
I '$$TM^%ZTLOAD D
. F MAGI=MAGI+1:1 S X=$P($T(@MAGTAG+MAGI),";;",2) Q:X="" D ^DIWP
. Q
E D
. S X="Enter 'Y' or 'N'; enter '^' to cancel. " D ^DIWP
. Q
;--- Load the help text into the ^DIR parameter and print it
S MAGI=0
F S MAGI=$O(^UTILITY($J,"W",DIWL,MAGI)) Q:MAGI'>0 D
. S DIR("?",MAGI)=$J("",DIWL-1)_^UTILITY($J,"W",DIWL,MAGI,0)
. W !,DIR("?",MAGI)
. Q
W !
;--- Special processing for the last line of the help text
S MAGI=+$O(DIR("?",""),-1)
I MAGI>0 S DIR("?")=DIR("?",MAGI) K DIR("?",MAGI)
;--- Cleanup
K ^UTILITY($J,"W")
Q
;
;+++++ RETURNS THE MESSAGE DESCRIBING RESULTS OF THE INDEX BUILD
;
; RC Error descriptor (see the $$ERROR^MAGUERR)
;
NDXMSG(RC) ;
N PREFIX
S PREFIX="MAG*3*93: "
;--- Error
Q:RC<-1 PREFIX_RC
;--- Stopped by user
Q:+RC=-1 PREFIX_"Image indexing task was stopped by the user."
;--- Success
Q PREFIX_"New indexes of the image files have been built."
;
;***** BACKGROUND TASK THAT BUILDS THE IMAGE INDEXES
;
; Input Variables
; ===============
;
; MAGDUZ Identifier of the user who started the task and who
; will receive the alert when the task finishes (IEN
; in the NEW PERSON file (#200)).
;
; MAGSUSPEND Controls suspension of the task on working days
; ^01: Suspend the task (0|1)
; ^02: Start time (FileMan)
; ^03: End time (FileMan)
;
NDXTASK ;
N MAGRC
;--- Build the indexes
S MAGRC=$$NDXBLD($G(MAGSUSPEND))
;--- Send the alert
D:$G(MAGDUZ)>0
. N TMP,XQA,XQAARCH,XQACNDEL,XQADATA,XQAFLG,XQAGUID,XQAID
. N XQAMSG,XQAOPT,XQAREVUE,XQAROU,XQASUPV,XQASURO,XQATEXT
. S XQAMSG=$$NDXMSG(MAGRC)
. S XQATEXT(1)=""
. S XQATEXT(2)="Date/Time of completion: "_$$FMTE^XLFDT($$NOW^XLFDT)
. S XQA(+MAGDUZ)="",XQAFLG="D"
. S TMP=$$SETUP1^XQALERT
. Q
;--- Keep the task descriptor only in case of error(s)
S:MAGRC'<0 ZTREQ="@"
K MAGDUZ,MAGSUSPEND
Q
;
;***** POST-INSTALL CODE
POS ;
N CALLBACK
D CLEAR^MAGUERR(1)
;
;--- Link new remote procedures to the Broker context option
S CALLBACK="$$ADDRPCS^"_$NA(MAGKIDS1("RPCLST^"_$T(+0),"MAG WINDOWS"))
I $$CP^MAGKIDS("MAG ATTACH RPCS",CALLBACK)<0 D ERROR Q
;
;--- Enable version checking for all sites
S CALLBACK="$$VERCHKON^MAGKIDS1"
I $$CP^MAGKIDS("MAG VERSION CHECK",CALLBACK)<0 D ERROR Q
;
;--- Restart the Imaging Utilization Report task
I $$CP^MAGKIDS("MAG REPORT TASK","$$RPTSKCP^"_$T(+0))<0 D ERROR Q
;
;--- Build new indexes in the files #2005 and #2005.1
I $$CP^MAGKIDS("MAG IMAGE INDEXES","$$NDXCP^"_$T(+0))<0 D ERROR Q
;
;--- Send the notification e-mail
I $$CP^MAGKIDS("MAG NOTIFICATION","$$NOTIFY^MAGKIDS1")<0 D ERROR Q
Q
;
;***** PRE-INSTALL CODE
PRE ;
;--- Delete the field #4; it will be replaced by the field #5.5
D DELFLDS^MAGKIDS(2006.81,"4")
Q
;
;+++++ UPDATES THE PROGRESS INDICATOR
PROGRESS(CNT) ;
;--- Reset the progress indicator
I $G(CNT)'>0 D Q
. I '$D(XPDNM) W !," 0.00%" Q
. N XPDIDTOT
. S XPDIDTOT=0 D UPDATE^XPDID(0)
. Q
;--- Make sure that we never see more than 100%
I $G(XPDIDTOT)>0 S:CNT>XPDIDTOT CNT=XPDIDTOT
;--- Update the indicator
I $D(XPDNM) D UPDATE^XPDID(CNT) Q
I $G(XPDIDTOT)>0 S $X=0 W *13,?3,$J(CNT/XPDIDTOT*100,0,2)_"%"
Q
;
;***** MANUAL STARTER OF THE INDEX BUILDER TASK
REINDEX ;
N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EXIT,SCHEDULE,X,Y,ZTSAVE
D CLEAR^MAGUERR(1)
S SCHEDULE=0
;
;=== Request parameter values from the user
S EXIT=0 D Q:EXIT
. ;--- Select the index building mode
. K DIR S DIR(0)="Y"
. S DIR("A")="Schedule the task that builds the indexes"
. D NDXHLP(.DIR)
. D ^DIR I $D(DIRUT) S EXIT=1 Q
. Q:'Y
. ;--- The task will be scheduled
. S SCHEDULE=1,ZTSAVE("MAGDUZ")=$G(DUZ)
. ;--- Prompt for the task suspension mode
. K DIR S DIR(0)="Y",DIR("B")="YES"
. S DIR("A")="Suspend the task during business hours (7am - 8pm)"
. D ^DIR I $D(DIRUT) S EXIT=1 Q
. S:Y ZTSAVE("MAGSUSPEND")="1^.07^.2"
. Q
;
;=== Schedule the task that will build the indexes
I SCHEDULE D Q
. N ZTCPU,ZTDESC,ZTDTH,ZTIO,ZTKIL,ZTPRI,ZTRTN,ZTSK,ZTSYNC,ZTUCI
. S ZTRTN="NDXTASK^"_$T(+0),ZTIO=""
. S ZTDESC="Image index builder (MAG*3*93)"
. D ^%ZTLOAD W !
. I $G(ZTSK)="" D ERROR^MAGUERR(-39),DUMP^MAGUERR1() Q
. W !,"Task #"_ZTSK_" has been scheduled."
. Q
;
;=== Build the indexes in the current session
K DIR S DIR(0)="Y"
S DIR("A")="Build the image indexes now"
D ^DIR Q:$D(DIRUT)
I Y,$$NDXBLD()<0 W ! D DUMP^MAGUERR1()
Q
;
;+++++ LIST OF NEW REMOTE PROCEDURES
RPCLST ;
;;MAG4 IMAGE LIST
;;MAGG IMAGE LOCK
;;MAGG IMAGE GET PROPERTIES
;;MAGG IMAGE SET PROPERTIES
;;MAGG IMAGE STATISTICS
;;MAGG IMAGE UNLOCK
;;MAGG REASON GET PROPERTIES
;;MAGG REASON LIST
;;MAGG CAPTURE USERS
Q
;
;+++++ RESTARTS THE IMAGING UTILIZATION REPORT TASK
RPTSKCP() ;
D REMTASK^MAGQE4,STTASK^MAGQE4
Q 0
;
;+++++ CHECKS IF THE TASK SHOULD BE SUSPENDED
;
; .DTNEXT Date/Time of the next event (suspend/resume)
; is returned via this parameter
;
; Input Variables
; ===============
; MAGSUSPEND
;
; Return Values
; =============
; 0 Continue/Resume
; 1 Suspend
;
SUSPEND(DTNEXT) ;
N DATE,NOW,SUSPEND,TIME,TR,TS
S TS=$P(MAGSUSPEND,U,2),TR=$P(MAGSUSPEND,U,3)
S NOW=$$NOW^XLFDT,DATE=NOW\1
;--- A work day
I $$WDCHK^MAGUTL03(DATE) D Q SUSPEND
. S TIME=NOW-DATE,SUSPEND=0
. I TIME<TS S DTNEXT=DATE+TS Q
. I TIME'<TR S DTNEXT=$$WDNEXT^MAGUTL03(DATE)+TS Q
. S DTNEXT=DATE+TR,SUSPEND=1
. Q
;--- Saturday, Sunday or Holiday
S DTNEXT=$$WDNEXT^MAGUTL03(DATE)+TS
Q 0
;
;+++++ RE-INDEXES THE IMAGE RECORD
XREF(MAGFILE,MAGIEN) ;
N GRPIEN,TMP,X0,X2
S X0=$G(^MAG(MAGFILE,MAGIEN,0)),X2=$G(^(2))
S GRPIEN=+$P(X0,U,10) ; GROUP PARENT (14)
;---
I GRPIEN D:MAGFILE=2005.1
. ;--- AGP
. S ^MAG(MAGFILE,"AGP",GRPIEN,MAGIEN)=""
. Q
E D
. N DFN,PDT
. S PDT=$P(X2,U,5) Q:'PDT ; PROCEDURE/EXAM DATE/TIME (15)
. ;--- APDT
. S ^MAG(MAGFILE,"APDT",PDT,MAGIEN)=""
. ;--- IMAGE file (#2005) already has the APDTPX index
. Q:MAGFILE=2005
. ;--- APDTPX
. S DFN=$P(X0,U,7) Q:'DFN ; PATIENT (5)
. S TMP=$P(X0,U,8) Q:TMP="" ; PROCEDURE (6)
. S ^MAG(MAGFILE,"APDTPX",DFN,9999999.9999-PDT,TMP,MAGIEN)=""
. Q
;--- ACA
D:'$P(X2,U,12) ; CAPTURE APPLICATION (8.1)
. N X100,PACS
. S X100=$G(^MAG(MAGFILE,MAGIEN,100)),PACS=$G(^("PACS"))
. S TMP=$TR($P(PACS,U,1,3),"^ ") ; Fields 60, 61, and 62
. S $P(^MAG(MAGFILE,MAGIEN,2),U,12)=$S($P(X100,U,5)'="":"I",TMP'="":"D",1:"C")
. Q
;--- Done
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGIPS93 15708 printed Dec 13, 2024@02:06:31 Page 2
MAGIPS93 ;WOIFO/SG - INSTALL CODE FOR MAG*3*93 ; 5/13/09 10:01am
+1 ;;3.0;IMAGING;**93**;Dec 02, 2009;Build 163
+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 ;; | |
+11 ;; | The Food and Drug Administration classifies this software as |
+12 ;; | a medical device. As such, it may not be changed in any way. |
+13 ;; | Modifications to this software may result in an adulterated |
+14 ;; | medical device under 21CFR820, the use of which is considered |
+15 ;; | to be a violation of US Federal Statutes. |
+16 ;; +---------------------------------------------------------------+
+17 ;
+18 ; There are no environment checks here but the MAGIPS93 has to be
+19 ; referenced by the "Environment Check Routine" field of the KIDS
+20 ; build so that entry points of the routine are available to the
+21 ; KIDS during all installation phases.
+22 QUIT
+23 ;
+24 ;+++++ INSTALLATION ERROR HANDLING
ERROR ;
+1 if $DATA(XPDNM)
SET XPDABORT=1
+2 ;--- Display the messages and store them to the INSTALL file
+3 DO DUMP^MAGUERR1()
DO ABTMSG^MAGKIDS()
+4 QUIT
+5 ;
+6 ;+++++ UPDATES/FIXES THE DELETED IMAGE ENTRY
+7 ;
+8 ; MAGIEN IEN of an entry of the IMAGE AUDIT file (#2005.1)
+9 ;
+10 ; Input Variables
+11 ; ===============
+12 ; MAGSTAT
+13 ;
+14 ; Return Values
+15 ; =============
+16 ; <0 Error descriptor (see the $$ERROR^MAGUERR)
+17 ; 0 Ok
+18 ;
MAGAUDIT(MAGIEN) ;
+1 NEW MAGNODE,MAGRC,STC,SUB,TMP
+2 SET MAGNODE=$NAME(^MAG(2005.1,MAGIEN))
+3 if $DATA(@MAGNODE)<10
QUIT $$ERROR^MAGUERR(-22,,2005.1,MAGIEN_",")
+4 ; STATUS (113)
SET STC=$PIECE($GET(@MAGNODE@(100)),U,8)
if STC=12
QUIT 0
+5 SET MAGRC=0
+6 ;
+7 ;=== Fix the subfile headers
+8 FOR SUB="1^2005.14P","4^2005.1106DA","5^2005.11PA","6^2005.1111A","99^2005.199D"
Begin DoDot:1
+9 SET TMP=$PIECE(SUB,U)
if '($DATA(^MAG(2005.1,MAGIEN,TMP,0))#2)
QUIT
+10 SET $PIECE(^MAG(2005.1,MAGIEN,TMP,0),U,2)=$PIECE(SUB,U,2)
+11 QUIT
End DoDot:1
+12 ;
+13 ;=== Update STATUS field and create the corresponding audit record
+14 ; DELETED DATE (30.1)
SET TMP=+$PIECE($GET(@MAGNODE@(30)),U,2)
+15 IF TMP>0
Begin DoDot:1
+16 NEW IENS,MAGFDA,MAGMSG
+17 SET IENS="+1,"_MAGIEN_","
+18 ; DATE/TIME RECORDED
SET MAGFDA(2005.199,IENS,.01)=TMP
+19 ; FIELD NUMBER
SET MAGFDA(2005.199,IENS,.02)=113
+20 ;--- USER = DELETED BY (30)
+21 SET MAGFDA(2005.199,IENS,.03)=$PIECE($GET(@MAGNODE@(30)),U)
+22 ;--- OLD INTERNAL VALUE and OLD EXTERNAL VALUE
+23 if STC>0
Begin DoDot:2
+24 SET MAGFDA(2005.199,IENS,1)=STC
+25 if $GET(MAGSTAT(STC))'=""
SET MAGFDA(2005.199,IENS,2)=MAGSTAT(STC)
+26 QUIT
End DoDot:2
+27 ;--- Create audit record for the status update
+28 DO UPDATE^DIE(,"MAGFDA",,"MAGMSG")
+29 if $GET(DIERR)
SET MAGRC=$$DBS^MAGUERR("MAGMSG",2005.1,MAGIEN_",")
+30 QUIT
End DoDot:1
if MAGRC<0
QUIT MAGRC
+31 ; STATUS = 'Deleted'
SET $PIECE(@MAGNODE@(100),U,8)=12
+32 ;
+33 ;===
+34 QUIT MAGRC
+35 ;
+36 ;+++++ BUILDS NEW INDEXES IN FILES #2005 AND #2005.1
+37 ;
+38 ; MAGSUSPEND Task suspension parameters
+39 ; ^01: Suspend the task (0|1)
+40 ; ^02: Suspension start time (e.g. 7am: .07)
+41 ; ^03: Suspension end time (e.g. 8pm: .2)
+42 ;
+43 ; Input Variables
+44 ; ===============
+45 ; XPDNM, ZTQUEUED
+46 ;
+47 ; Return Values
+48 ; =============
+49 ; <0 Error descriptor (see the $$ERROR^MAGUERR)
+50 ; 0 Ok
+51 ;
+52 ; Notes
+53 ; =====
+54 ;
+55 ; This function also populates the STATUS field (113) and fixes
+56 ; headers of all multiples of the IMAGE AUDIT file (#2005.1).
+57 ;
NDXBLD(MAGSUSPEND) ;
+1 ; Number of the file that is being processed
NEW MAGFILE
+2 ; Controls image audit indexes (see AUDIT^MAGUXRF)
NEW MAGNOFMAUDIT
+3 ; Closed root of the file that is being processed
NEW MAGROOT
+4 ; List of status codes and their descriptions
NEW MAGSTAT
+5 ;
+6 NEW DTNEXT,MAGCNT,MAGIEN,MAGRC,SILENT,TH,TMP
+7 SET SILENT=$SELECT($GET(XPDNM)'="":0,1:$DATA(ZTQUEUED))
SET MAGRC=0
+8 if 'SILENT
DO BMES^MAGKIDS("Building new image indexes...")
+9 ;
+10 ;=== Get the image status codes
+11 Begin DoDot:1
+12 NEW BUF,I
+13 SET BUF=$$GET1^DID(2005,113,,"POINTER")
+14 FOR I=1:1
SET TMP=$PIECE(BUF,";",I)
if TMP=""
QUIT
Begin DoDot:2
+15 SET MAGSTAT(+TMP)=$PIECE(TMP,":",2)
+16 QUIT
End DoDot:2
+17 QUIT
End DoDot:1
+18 ;
+19 ;=== Do not update the AUDIT multiple (99)
+20 SET MAGNOFMAUDIT=1
+21 ;
+22 ;=== Build the indexes
+23 FOR MAGFILE=2005,2005.1
Begin DoDot:1
+24 IF 'SILENT
Begin DoDot:2
+25 SET TMP=$$GET1^DID(MAGFILE,,,"NAME")
+26 QUIT
End DoDot:2
DO MES^MAGKIDS(TMP_" file (#"_MAGFILE_")")
+27 ;--- Check if the file has been processed already
+28 IF $$PRD^MAGKIDS(MAGFILE,93)
if 'SILENT
Begin DoDot:2
+29 DO MES^MAGKIDS("This file is already processed.")
+30 QUIT
End DoDot:2
QUIT
+31 ;--- Initialize
+32 SET XPDIDTOT=$$GET1^DID(MAGFILE,,,"ENTRIES")
+33 IF XPDIDTOT'>0
if 'SILENT
DO MES^MAGKIDS("This file is empty.")
QUIT
+34 SET MAGROOT=$$ROOT^DILFD(MAGFILE,,1)
SET DIK=$$OREF^DILF(MAGROOT)
+35 ;--- Delete the indexes (in case of restart)
+36 KILL @MAGROOT@("APDT")
+37 if MAGFILE=2005.1
KILL @MAGROOT@("AGP"),^("APDTPX")
+38 ;--- Process the file
+39 SET (MAGCNT,MAGIEN)=0
+40 FOR
SET MAGIEN=$ORDER(@MAGROOT@(MAGIEN))
if 'MAGIEN
QUIT
Begin DoDot:2
+41 IF '(MAGCNT#1000)
Begin DoDot:3
+42 IF '$DATA(ZTQUEUED)
DO PROGRESS(MAGCNT)
QUIT
+43 ;--- Check if task stop has been requested
+44 IF $$S^%ZTLOAD
SET MAGRC=$$ERROR^MAGUERR(-1)
QUIT
+45 ;--- Check if the task should be suspended
+46 if '$GET(MAGSUSPEND)
QUIT
+47 if $$NOW^XLFDT<$G(DTNEXT)
QUIT
+48 if '$$SUSPEND(.DTNEXT)
QUIT
+49 ;--- Suspend the task during the peak hours
+50 FOR
Begin DoDot:4
+51 SET TH=$$FMDIFF^XLFDT(DTNEXT,$$NOW^XLFDT,2)
+52 ; Do not HANG for less than a
IF TH<60
SET TH=0
QUIT
+53 ; minute and more than an hour
HANG $SELECT(TH>3600:3600,1:TH)
+54 ;--- Check if task stop has been requested
+55 if $$S^%ZTLOAD
SET MAGRC=$$ERROR^MAGUERR(-1)
+56 QUIT
End DoDot:4
if 'TH!MAGRC<0
QUIT
+57 QUIT
End DoDot:3
if MAGRC<0
QUIT
+58 SET MAGCNT=MAGCNT+1
+59 ;--- Additional processing for IMAGE AUDIT record
+60 IF MAGFILE=2005.1
SET MAGRC=$$MAGAUDIT(MAGIEN)
if MAGRC<0
QUIT
+61 ;--- Re-index the record
+62 DO XREF(MAGFILE,MAGIEN)
+63 QUIT
End DoDot:2
if MAGRC<0
QUIT
+64 ;--- Indicate the final state of the process
+65 if '$DATA(ZTQUEUED)
DO PROGRESS(MAGCNT)
+66 DO PRD^MAGKIDS(MAGFILE,93,"A")
+67 QUIT
End DoDot:1
if MAGRC<0
QUIT
+68 if MAGRC<0
QUIT MAGRC
+69 ;
+70 ;=== Success
+71 if 'SILENT
DO MES^MAGKIDS("The indexes have been successfully built.")
+72 QUIT 0
+73 ;
+74 ;+++++ CALLBACK FUNCTION FOR THE IMGAGE INDEX CHECKPOINT
+75 ;
+76 ; Input Variables
+77 ; ===============
+78 ; DUZ, XPDQUES, ZTQUEUED
+79 ;
NDXCP() ;
+1 NEW MAGRC
+2 SET MAGRC=0
+3 ;
+4 ;=== Schedule a separate task that will build image indexes
+5 IF $GET(XPDQUES("POS02-MODE"))
Begin DoDot:1
+6 NEW MSG,ZTCPU,ZTDESC,ZTDTH,ZTIO,ZTKIL,ZTPRI
+7 NEW ZTRTN,ZTSAVE,ZTSK,ZTSYNC,ZTUCI
+8 SET ZTSAVE("MAGDUZ")=$GET(DUZ)
+9 if $GET(XPDQUES("POS10-SUSPEND"))
SET ZTSAVE("MAGSUSPEND")="1^.07^.2"
+10 SET ZTRTN="NDXTASK^"_$TEXT(+0)
SET ZTIO=""
+11 SET ZTDESC="Image index builder (MAG*3*93)"
+12 SET ZTDTH=$GET(XPDQUES("POS05-SCHEDULEAT"))
+13 if ZTDTH'>0
SET ZTDTH=$$NOW^XLFDT
+14 DO ^%ZTLOAD
+15 IF $GET(ZTSK)=""
SET MAGRC=$$ERROR^MAGUERR(-39)
QUIT
+16 ;--- Display the confirmation message
+17 SET MSG(1)="It will rebuild indexes in the IMAGE (#2005) and IMAGE AUDIT (#2005.1)"
+18 SET MSG(2)="files and perform other post-processing actions."
+19 DO BMES^MAGKIDS("Task #"_ZTSK_" has been scheduled.",.MSG)
+20 QUIT
End DoDot:1
QUIT MAGRC
+21 ;
+22 ;=== Build the indexes as part of the patch post-install
+23 QUIT $$NDXBLD()
+24 ;
+25 ;***** FORMATS AND PRINTS THE HELP TEXT FOR THE INDEX TASK MODE
NDXHLP(DIR,KIDS) ;
+1 ;;Patch MAG*3*93 defines new indexes for the IMAGE (#2005) and IMAGE
+2 ;;AUDIT (#2005.1) files. These indexes can be built as a part of the
+3 ;;patch KIDS build installation or the post-install code can schedule
+4 ;;a separate task that will build the indexes.
+5 ;;
+6 ;;However, it appears that the Taskman is not running on this system.
+7 ;;As the result, you will not be given a choice and the indexes will
+8 ;;be built as part of the post-install. If you want to schedule a
+9 ;;separate indexing task, abort the installation, start the Taskman,
+10 ;;and restart the patch installation.
NDXHLP1 ;
+1 ;;Patch MAG*3*93 defines new indexes for the IMAGE (#2005) and IMAGE
+2 ;;AUDIT (#2005.1) files. These indexes can be built in the current
+3 ;;session (this will block it for quite a long time) or a separate
+4 ;;task can be scheduled.
+5 ;;
+6 ;;However, it appears that the Taskman is not running on this system.
+7 ;;If you want to schedule a separate indexing task, exit this option,
+8 ;;start the Taskman, and run the option again.
+9 ;
+10 NEW DIWF,DIWL,DIWR,MAGI,MAGTAG,X
+11 SET MAGTAG=$SELECT($GET(KIDS):"NDXHLP",1:"NDXHLP1")
+12 SET DIWF=""
SET DIWL=4
SET DIWR=$GET(IOM,80)-DIWL+1
+13 KILL ^UTILITY($JOB,"W"),DIR("?")
+14 ;--- Format the main help text
+15 FOR MAGI=1:1
SET X=$PIECE($TEXT(@MAGTAG+MAGI),";;",2)
if X=""
QUIT
DO ^DIWP
+16 SET X=" "
DO ^DIWP
+17 ;--- Add the warning if the Taskman is not running
+18 IF '$$TM^%ZTLOAD
Begin DoDot:1
+19 FOR MAGI=MAGI+1:1
SET X=$PIECE($TEXT(@MAGTAG+MAGI),";;",2)
if X=""
QUIT
DO ^DIWP
+20 QUIT
End DoDot:1
+21 IF '$TEST
Begin DoDot:1
+22 SET X="Enter 'Y' or 'N'; enter '^' to cancel. "
DO ^DIWP
+23 QUIT
End DoDot:1
+24 ;--- Load the help text into the ^DIR parameter and print it
+25 SET MAGI=0
+26 FOR
SET MAGI=$ORDER(^UTILITY($JOB,"W",DIWL,MAGI))
if MAGI'>0
QUIT
Begin DoDot:1
+27 SET DIR("?",MAGI)=$JUSTIFY("",DIWL-1)_^UTILITY($JOB,"W",DIWL,MAGI,0)
+28 WRITE !,DIR("?",MAGI)
+29 QUIT
End DoDot:1
+30 WRITE !
+31 ;--- Special processing for the last line of the help text
+32 SET MAGI=+$ORDER(DIR("?",""),-1)
+33 IF MAGI>0
SET DIR("?")=DIR("?",MAGI)
KILL DIR("?",MAGI)
+34 ;--- Cleanup
+35 KILL ^UTILITY($JOB,"W")
+36 QUIT
+37 ;
+38 ;+++++ RETURNS THE MESSAGE DESCRIBING RESULTS OF THE INDEX BUILD
+39 ;
+40 ; RC Error descriptor (see the $$ERROR^MAGUERR)
+41 ;
NDXMSG(RC) ;
+1 NEW PREFIX
+2 SET PREFIX="MAG*3*93: "
+3 ;--- Error
+4 if RC<-1
QUIT PREFIX_RC
+5 ;--- Stopped by user
+6 if +RC=-1
QUIT PREFIX_"Image indexing task was stopped by the user."
+7 ;--- Success
+8 QUIT PREFIX_"New indexes of the image files have been built."
+9 ;
+10 ;***** BACKGROUND TASK THAT BUILDS THE IMAGE INDEXES
+11 ;
+12 ; Input Variables
+13 ; ===============
+14 ;
+15 ; MAGDUZ Identifier of the user who started the task and who
+16 ; will receive the alert when the task finishes (IEN
+17 ; in the NEW PERSON file (#200)).
+18 ;
+19 ; MAGSUSPEND Controls suspension of the task on working days
+20 ; ^01: Suspend the task (0|1)
+21 ; ^02: Start time (FileMan)
+22 ; ^03: End time (FileMan)
+23 ;
NDXTASK ;
+1 NEW MAGRC
+2 ;--- Build the indexes
+3 SET MAGRC=$$NDXBLD($GET(MAGSUSPEND))
+4 ;--- Send the alert
+5 if $GET(MAGDUZ)>0
Begin DoDot:1
+6 NEW TMP,XQA,XQAARCH,XQACNDEL,XQADATA,XQAFLG,XQAGUID,XQAID
+7 NEW XQAMSG,XQAOPT,XQAREVUE,XQAROU,XQASUPV,XQASURO,XQATEXT
+8 SET XQAMSG=$$NDXMSG(MAGRC)
+9 SET XQATEXT(1)=""
+10 SET XQATEXT(2)="Date/Time of completion: "_$$FMTE^XLFDT($$NOW^XLFDT)
+11 SET XQA(+MAGDUZ)=""
SET XQAFLG="D"
+12 SET TMP=$$SETUP1^XQALERT
+13 QUIT
End DoDot:1
+14 ;--- Keep the task descriptor only in case of error(s)
+15 if MAGRC'<0
SET ZTREQ="@"
+16 KILL MAGDUZ,MAGSUSPEND
+17 QUIT
+18 ;
+19 ;***** POST-INSTALL CODE
POS ;
+1 NEW CALLBACK
+2 DO CLEAR^MAGUERR(1)
+3 ;
+4 ;--- Link new remote procedures to the Broker context option
+5 SET CALLBACK="$$ADDRPCS^"_$NAME(MAGKIDS1("RPCLST^"_$TEXT(+0),"MAG WINDOWS"))
+6 IF $$CP^MAGKIDS("MAG ATTACH RPCS",CALLBACK)<0
DO ERROR
QUIT
+7 ;
+8 ;--- Enable version checking for all sites
+9 SET CALLBACK="$$VERCHKON^MAGKIDS1"
+10 IF $$CP^MAGKIDS("MAG VERSION CHECK",CALLBACK)<0
DO ERROR
QUIT
+11 ;
+12 ;--- Restart the Imaging Utilization Report task
+13 IF $$CP^MAGKIDS("MAG REPORT TASK","$$RPTSKCP^"_$TEXT(+0))<0
DO ERROR
QUIT
+14 ;
+15 ;--- Build new indexes in the files #2005 and #2005.1
+16 IF $$CP^MAGKIDS("MAG IMAGE INDEXES","$$NDXCP^"_$TEXT(+0))<0
DO ERROR
QUIT
+17 ;
+18 ;--- Send the notification e-mail
+19 IF $$CP^MAGKIDS("MAG NOTIFICATION","$$NOTIFY^MAGKIDS1")<0
DO ERROR
QUIT
+20 QUIT
+21 ;
+22 ;***** PRE-INSTALL CODE
PRE ;
+1 ;--- Delete the field #4; it will be replaced by the field #5.5
+2 DO DELFLDS^MAGKIDS(2006.81,"4")
+3 QUIT
+4 ;
+5 ;+++++ UPDATES THE PROGRESS INDICATOR
PROGRESS(CNT) ;
+1 ;--- Reset the progress indicator
+2 IF $GET(CNT)'>0
Begin DoDot:1
+3 IF '$DATA(XPDNM)
WRITE !," 0.00%"
QUIT
+4 NEW XPDIDTOT
+5 SET XPDIDTOT=0
DO UPDATE^XPDID(0)
+6 QUIT
End DoDot:1
QUIT
+7 ;--- Make sure that we never see more than 100%
+8 IF $GET(XPDIDTOT)>0
if CNT>XPDIDTOT
SET CNT=XPDIDTOT
+9 ;--- Update the indicator
+10 IF $DATA(XPDNM)
DO UPDATE^XPDID(CNT)
QUIT
+11 IF $GET(XPDIDTOT)>0
SET $X=0
WRITE *13,?3,$JUSTIFY(CNT/XPDIDTOT*100,0,2)_"%"
+12 QUIT
+13 ;
+14 ;***** MANUAL STARTER OF THE INDEX BUILDER TASK
REINDEX ;
+1 NEW DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,EXIT,SCHEDULE,X,Y,ZTSAVE
+2 DO CLEAR^MAGUERR(1)
+3 SET SCHEDULE=0
+4 ;
+5 ;=== Request parameter values from the user
+6 SET EXIT=0
Begin DoDot:1
+7 ;--- Select the index building mode
+8 KILL DIR
SET DIR(0)="Y"
+9 SET DIR("A")="Schedule the task that builds the indexes"
+10 DO NDXHLP(.DIR)
+11 DO ^DIR
IF $DATA(DIRUT)
SET EXIT=1
QUIT
+12 if 'Y
QUIT
+13 ;--- The task will be scheduled
+14 SET SCHEDULE=1
SET ZTSAVE("MAGDUZ")=$GET(DUZ)
+15 ;--- Prompt for the task suspension mode
+16 KILL DIR
SET DIR(0)="Y"
SET DIR("B")="YES"
+17 SET DIR("A")="Suspend the task during business hours (7am - 8pm)"
+18 DO ^DIR
IF $DATA(DIRUT)
SET EXIT=1
QUIT
+19 if Y
SET ZTSAVE("MAGSUSPEND")="1^.07^.2"
+20 QUIT
End DoDot:1
if EXIT
QUIT
+21 ;
+22 ;=== Schedule the task that will build the indexes
+23 IF SCHEDULE
Begin DoDot:1
+24 NEW ZTCPU,ZTDESC,ZTDTH,ZTIO,ZTKIL,ZTPRI,ZTRTN,ZTSK,ZTSYNC,ZTUCI
+25 SET ZTRTN="NDXTASK^"_$TEXT(+0)
SET ZTIO=""
+26 SET ZTDESC="Image index builder (MAG*3*93)"
+27 DO ^%ZTLOAD
WRITE !
+28 IF $GET(ZTSK)=""
DO ERROR^MAGUERR(-39)
DO DUMP^MAGUERR1()
QUIT
+29 WRITE !,"Task #"_ZTSK_" has been scheduled."
+30 QUIT
End DoDot:1
QUIT
+31 ;
+32 ;=== Build the indexes in the current session
+33 KILL DIR
SET DIR(0)="Y"
+34 SET DIR("A")="Build the image indexes now"
+35 DO ^DIR
if $DATA(DIRUT)
QUIT
+36 IF Y
IF $$NDXBLD()<0
WRITE !
DO DUMP^MAGUERR1()
+37 QUIT
+38 ;
+39 ;+++++ LIST OF NEW REMOTE PROCEDURES
RPCLST ;
+1 ;;MAG4 IMAGE LIST
+2 ;;MAGG IMAGE LOCK
+3 ;;MAGG IMAGE GET PROPERTIES
+4 ;;MAGG IMAGE SET PROPERTIES
+5 ;;MAGG IMAGE STATISTICS
+6 ;;MAGG IMAGE UNLOCK
+7 ;;MAGG REASON GET PROPERTIES
+8 ;;MAGG REASON LIST
+9 ;;MAGG CAPTURE USERS
+10 QUIT
+11 ;
+12 ;+++++ RESTARTS THE IMAGING UTILIZATION REPORT TASK
RPTSKCP() ;
+1 DO REMTASK^MAGQE4
DO STTASK^MAGQE4
+2 QUIT 0
+3 ;
+4 ;+++++ CHECKS IF THE TASK SHOULD BE SUSPENDED
+5 ;
+6 ; .DTNEXT Date/Time of the next event (suspend/resume)
+7 ; is returned via this parameter
+8 ;
+9 ; Input Variables
+10 ; ===============
+11 ; MAGSUSPEND
+12 ;
+13 ; Return Values
+14 ; =============
+15 ; 0 Continue/Resume
+16 ; 1 Suspend
+17 ;
SUSPEND(DTNEXT) ;
+1 NEW DATE,NOW,SUSPEND,TIME,TR,TS
+2 SET TS=$PIECE(MAGSUSPEND,U,2)
SET TR=$PIECE(MAGSUSPEND,U,3)
+3 SET NOW=$$NOW^XLFDT
SET DATE=NOW\1
+4 ;--- A work day
+5 IF $$WDCHK^MAGUTL03(DATE)
Begin DoDot:1
+6 SET TIME=NOW-DATE
SET SUSPEND=0
+7 IF TIME<TS
SET DTNEXT=DATE+TS
QUIT
+8 IF TIME'<TR
SET DTNEXT=$$WDNEXT^MAGUTL03(DATE)+TS
QUIT
+9 SET DTNEXT=DATE+TR
SET SUSPEND=1
+10 QUIT
End DoDot:1
QUIT SUSPEND
+11 ;--- Saturday, Sunday or Holiday
+12 SET DTNEXT=$$WDNEXT^MAGUTL03(DATE)+TS
+13 QUIT 0
+14 ;
+15 ;+++++ RE-INDEXES THE IMAGE RECORD
XREF(MAGFILE,MAGIEN) ;
+1 NEW GRPIEN,TMP,X0,X2
+2 SET X0=$GET(^MAG(MAGFILE,MAGIEN,0))
SET X2=$GET(^(2))
+3 ; GROUP PARENT (14)
SET GRPIEN=+$PIECE(X0,U,10)
+4 ;---
+5 IF GRPIEN
if MAGFILE=2005.1
Begin DoDot:1
+6 ;--- AGP
+7 SET ^MAG(MAGFILE,"AGP",GRPIEN,MAGIEN)=""
+8 QUIT
End DoDot:1
+9 IF '$TEST
Begin DoDot:1
+10 NEW DFN,PDT
+11 ; PROCEDURE/EXAM DATE/TIME (15)
SET PDT=$PIECE(X2,U,5)
if 'PDT
QUIT
+12 ;--- APDT
+13 SET ^MAG(MAGFILE,"APDT",PDT,MAGIEN)=""
+14 ;--- IMAGE file (#2005) already has the APDTPX index
+15 if MAGFILE=2005
QUIT
+16 ;--- APDTPX
+17 ; PATIENT (5)
SET DFN=$PIECE(X0,U,7)
if 'DFN
QUIT
+18 ; PROCEDURE (6)
SET TMP=$PIECE(X0,U,8)
if TMP=""
QUIT
+19 SET ^MAG(MAGFILE,"APDTPX",DFN,9999999.9999-PDT,TMP,MAGIEN)=""
+20 QUIT
End DoDot:1
+21 ;--- ACA
+22 ; CAPTURE APPLICATION (8.1)
if '$PIECE(X2,U,12)
Begin DoDot:1
+23 NEW X100,PACS
+24 SET X100=$GET(^MAG(MAGFILE,MAGIEN,100))
SET PACS=$GET(^("PACS"))
+25 ; Fields 60, 61, and 62
SET TMP=$TRANSLATE($PIECE(PACS,U,1,3),"^ ")
+26 SET $PIECE(^MAG(MAGFILE,MAGIEN,2),U,12)=$SELECT($PIECE(X100,U,5)'="":"I",TMP'="":"D",1:"C")
+27 QUIT
End DoDot:1
+28 ;--- Done
+29 QUIT