source: WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGDLB7.m@ 1736

Last change on this file since 1736 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.3 KB
RevLine 
[613]1MAGDLB7 ;WOIFO/LB - Utilities for file 2006.575 ; [ 06/20/2001 08:56 ]
2 ;;3.0;IMAGING;;Mar 01, 2002
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 Q
19REINDXF ;Reindex field 9 - Unique Study Identifications
20 N DIK
21 S DIK="^MAGD(2006.575,",DIK(1)="9"
22 D ENALL^DIK
23 Q
24EN ;
25 N DIR,DDAY,X,Y,DOUT,DROUT,NOWDAY
26 W !,"Will re-index field 9, Unique Study Id."
27 D REINDXF
28 I '$D(^MAGD(2006.575,"F")) W !,"Nothing to process" Q
29 D NOW^%DTC S NOWDAY=X
30 W !,"Entries will be delete up to the date you specify."
31EN1 ;restart point
32 S DIR(0)="DA",DIR("A")="Last date to keep."
33 S DIR("?")="Enter a date."
34 D ^DIR I 'Y!(Y="^") W !,"No date entered. Quitting." Q
35 S DDAY=Y I NOWDAY=DDAY W !,"Can not be today." G EN1
36 D PURGE
37 Q
38PURGE ;
39 N DATEPROC,IEN,NIEN,ITEM,SUID
40 S IEN=0,SUID="" F S SUID=$O(^MAGD(2006.575,"F",SUID)) W !,SUID Q:SUID="" D
41 . F S IEN=$O(^MAGD(2006.575,"F",SUID,IEN)) W !,IEN Q:'IEN D
42 . . I '$D(^MAGD(2006.575,IEN,0)) D Q
43 . . . K ^MAGD(2006.575,"F",SUID,IEN) ;Tidy up.
44 . . S DATEPROC=$P(^MAGD(2006.575,IEN,1),"^",3)
45 . . I DATEPROC>DDAY Q
46 . . I $D(^MAGD(2006.575,IEN,"RLATE")) D
47 . . . ;start purging the related entries 1st before the parent entry
48 . . . S NIEN=0 F S NIEN=$O(^MAGD(2006.575,IEN,"RLATE",NIEN)) Q:'NIEN D
49 . . . . Q:'$D(^MAGD(2006.575,IEN,"RLATE",NIEN,0))
50 . . . . S ITEM=$P(^MAGD(2006.575,IEN,"RLATE",NIEN,0),"^") Q:'ITEM
51 . . . . D REMOVE^MAGDLB5(ITEM) W "."
52 . . D REMOVE^MAGDLB5(IEN) W "."
53 W !,"Finished."
54 Q
Note: See TracBrowser for help on using the repository browser.