MAGFXQRS ;WOIFO/MLH - clean up headers in ^MAGDAUDT(2006.5733); 31-Jan-2012 19:27
 ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
 ;; 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
 ; This routine resolves issues in ^MAGDAUDT(2006.5733), whose header node
 ; and subnodes all formerly contained incorrect values in the file number
 ; portion of the header (e.g., '2006.57633' instead of '2006.5733').
 ; 
 Q
 ;
CLEANUP ;
 N FIL,FMDT,MAGIEN,ACTIX
 S FIL=$NA(^MAGDAUDT(2006.5733))
 L +@FIL:5 E  D  Q
 . W:$D(IO(0)) !,"ERROR: Could not lock statistics file!",!
 . Q
 W:$D(IO(0)) !,"Correcting headers on QUERY/RETRIEVE STATISTICS file (#2006.5733)..."
 S $P(@FIL@(0),"^",2)=2006.5733
 S FMDT=0
 F  S FMDT=$O(@FIL@(FMDT)) Q:'FMDT  D
 . S $P(@FIL@(FMDT,0),"^",2)=2006.57331
 . S MAGIEN=0
 . F  S MAGIEN=$O(@FIL@(FMDT,1,MAGIEN)) Q:'MAGIEN  D
 . . S $P(@FIL@(FMDT,1,MAGIEN,1,0),"^",2)=2006.57332
 . . S ACTIX=0
 . . F  S ACTIX=$O(@FIL@(FMDT,1,MAGIEN,1,ACTIX)) Q:'ACTIX  D
 . . . S $P(@FIL@(FMDT,1,MAGIEN,1,ACTIX,1,0),"^",2)=2006.57333
 . . . Q
 . . Q
 . Q
 W:$D(IO(0)) "done!"
 L -@FIL
 Q
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HMAGFXQRS   2076     printed  Sep 23, 2025@19:38:28                                                                                                                                                                                                    Page 2
MAGFXQRS  ;WOIFO/MLH - clean up headers in ^MAGDAUDT(2006.5733); 31-Jan-2012 19:27
 +1       ;;3.0;IMAGING;**118**;Mar 19, 2002;Build 4525;May 01, 2013
 +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      ; This routine resolves issues in ^MAGDAUDT(2006.5733), whose header node
 +19      ; and subnodes all formerly contained incorrect values in the file number
 +20      ; portion of the header (e.g., '2006.57633' instead of '2006.5733').
 +21      ; 
 +22       QUIT 
 +23      ;
CLEANUP   ;
 +1        NEW FIL,FMDT,MAGIEN,ACTIX
 +2        SET FIL=$NAME(^MAGDAUDT(2006.5733))
 +3        LOCK +@FIL:5
          IF '$TEST
               Begin DoDot:1
 +4                if $DATA(IO(0))
                       WRITE !,"ERROR: Could not lock statistics file!",!
 +5                QUIT 
               End DoDot:1
               QUIT 
 +6        if $DATA(IO(0))
               WRITE !,"Correcting headers on QUERY/RETRIEVE STATISTICS file (#2006.5733)..."
 +7        SET $PIECE(@FIL@(0),"^",2)=2006.5733
 +8        SET FMDT=0
 +9        FOR 
               SET FMDT=$ORDER(@FIL@(FMDT))
               if 'FMDT
                   QUIT 
               Begin DoDot:1
 +10               SET $PIECE(@FIL@(FMDT,0),"^",2)=2006.57331
 +11               SET MAGIEN=0
 +12               FOR 
                       SET MAGIEN=$ORDER(@FIL@(FMDT,1,MAGIEN))
                       if 'MAGIEN
                           QUIT 
                       Begin DoDot:2
 +13                       SET $PIECE(@FIL@(FMDT,1,MAGIEN,1,0),"^",2)=2006.57332
 +14                       SET ACTIX=0
 +15                       FOR 
                               SET ACTIX=$ORDER(@FIL@(FMDT,1,MAGIEN,1,ACTIX))
                               if 'ACTIX
                                   QUIT 
                               Begin DoDot:3
 +16                               SET $PIECE(@FIL@(FMDT,1,MAGIEN,1,ACTIX,1,0),"^",2)=2006.57333
 +17                               QUIT 
                               End DoDot:3
 +18                       QUIT 
                       End DoDot:2
 +19               QUIT 
               End DoDot:1
 +20       if $DATA(IO(0))
               WRITE "done!"
 +21       LOCK -@FIL
 +22       QUIT