AUMAUTFX ;IHS/OIT/ABK - AUM 10 patch 2 AD-HOC LOAD [ 10/10/2010 9:19 AM ]
;;11.0;TABLE MAINTENANCE;**5**;Oct 15,2010
;Utilites to facilitate AUM/AUTT Fix
;
;
DOFTG(PATH,FILENAME) ;
N GBL,GBLZISH,SUCCESS
K ^TMP("AUMPFIX",$J)
S GBL="^TMP(""AUMPFIX"",$J)"
S GBLZISH="^TMP(""AUMPFIX"",$J,1)"
S GBLZISH=$NA(@GBLZISH)
S SUCCESS=$$FTG^%ZISH(PATH,FILENAME,GBLZISH,3)
Q
;
DOGTF(PATH,FILENAME) ;
N GBL,GBLZISH,SUCCESS
S GBL="^TMP(""AUMPFIX"",$J)"
S GBLZISH="^TMP(""AUMPFIX"",$J,1)"
S GBLZISH=$NA(@GBLZISH)
S SUCCESS=$$GTF^%ZISH(GBLZISH,3,PATH,FILENAME)
Q
;
FIX ;
N AUMDA,AUMDA1,TOTCNT,AUMERR,TOTUPD,FIXSTR,AUMCNAM,AUMMNE,AUMMJT
S AUMDA="",TOTCNT=0,AUMERR=0,TOTUPD=0
F S AUMDA=$O(^TMP("AUMPFIX",$J,AUMDA)) Q:AUMDA="" S FIXSTR=^(AUMDA) D
.S TOTCNT=TOTCNT+1
.S AUMCNAM=$P(FIXSTR,U,4)_"-"_$P(FIXSTR,U,5),AUMMNE=$P(FIXSTR,U,3),AUMMJT=$P(FIXSTR,U,4)
.; Do error checking
.I AUMCNAM="" D BMES^XPDUTL("Name field is null "_AUMCNAM_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.I AUMMNE="" D BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.; Ok - past that
.S AUMDA1=0,AUMDA1=$O(^AUTTEDT("C",AUMMNE,AUMDA1))
.I AUMDA1'="" D ; DA NOT NULL,updating
..S TOTUPD=TOTUPD+1
..S DIE="^AUTTEDT(",DA=AUMDA1 ;,DIC(0)="L"
..S DR=".01////"_AUMCNAM_";1////"_AUMMNE_";.06////"_AUMMJT_";.03////@"
..D ^DIE D BMES^XPDUTL("Updated - Name = "_AUMCNAM_" Mnemonic = "_AUMMNE)
..D ^XBFMK
..Q
.Q
D BMES^XPDUTL("Total records processed: "_TOTCNT)
D BMES^XPDUTL("Total records in error: "_AUMERR)
D BMES^XPDUTL("Total records updated: "_TOTUPD)
Q
;
FIXAUM ;
N AUMDA,AUMDA1,TOTCNT,AUMERR,TOTUPD,FIXSTR,AUMCNAM,AUMMNE,AUMMJT
S AUMDA="",TOTCNT=0,AUMERR=0,TOTUPD=0
F S AUMDA=$O(^TMP("AUMPFIX",$J,AUMDA)) Q:AUMDA="" S FIXSTR=^(AUMDA) D
.S TOTCNT=TOTCNT+1
.S AUMCNAM=$P(FIXSTR,U,4)_"-"_$P(FIXSTR,U,5),AUMMNE=$P(FIXSTR,U,3),AUMMJT=$P(FIXSTR,U,4)
.; Do error checking
.I AUMCNAM="" D BMES^XPDUTL("Name field is null "_AUMCNAM_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.I AUMMNE="" D BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.; Ok - past that
.S AUMDA1=0,AUMDA1=$O(^AUTTEDT("C",AUMMNE,AUMDA1))
.I $D(^AUMPCLN(AUMMNE)) S XSTR=^(AUMMNE),$P(XSTR,U,2)=AUMCNAM,$P(XSTR,U,4)=AUMMJT,^AUMPCLN(AUMMNE)=XSTR,TOTUPD=TOTUPD+1
.E D BMES^XPDUTL("Mnemonic - "_AUMMNE_" does not exist - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1
.Q
D BMES^XPDUTL("Total records processed: "_TOTCNT)
D BMES^XPDUTL("Total records in error: "_AUMERR)
D BMES^XPDUTL("Total records updated: "_TOTUPD)
Q
UPPER(X) Q $TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
; End of routine
FIXSMT ; Fix Target AUTTEDMT data, translate to upper and remove apostrophes
N X1,X2,X3,AUMDA
S AUMDA=0
F S AUMDA=$O(^AUTTEDMT(AUMDA)) Q:AUMDA="B" S X1=^(AUMDA,0),X2=$TR(X1,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ"),X3=$TR(X2,"'") S ^AUTTEDMT(AUMDA,0)=X3
Q
FIXEDMT ; Fix AUTTEDMT global, by updating it with new major topics
N AUMDA,AUMDA1,TOTCNT,AUMERR,TOTNEW,TOTUPD,FIXSTR,AUMMNE,AUMMJT
S AUMDA="",TOTCNT=0,AUMERR=0,TOTNEW=0,TOTUPD=0
F S AUMDA=$O(^AUMPMT(AUMDA)) Q:AUMDA="" S FIXSTR=^(AUMDA) D
.S TOTCNT=TOTCNT+1
.S AUMMNE=$P(FIXSTR,U,1),AUMMJT=$P(FIXSTR,U,2)
.; Do error checking
.I AUMMJT="" D BMES^XPDUTL("Topic Name field is null "_AUMMJT_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.I AUMMNE="" D BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error"),BMES^XPDUTL("Record: "_FIXSTR) S AUMERR=AUMERR+1 Q
.; Ok - past that
.S AUMDA1=0,AUMDA1=$O(^AUTTEDMT("B",AUMMNE,AUMDA1))
.I AUMDA1'="" D ; DA NOT NULL,updating
..S TOTUPD=TOTUPD+1
..S DIE="^AUTTEDMT(",DA=AUMDA1 ;,DIC(0)="L"
..S DR=".01////"_AUMMJT_";.02////"_AUMMNE
..D ^DIE D BMES^XPDUTL("Updated - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
..D ^XBFMK
..Q
.I AUMDA1="" D ; DA NULL,RECORD MISSING,SO WE ADD IT
..S X=AUMMJT,DIC="^AUTTEDMT(",DIC(0)="L"
..S DIC("DR")=".02////"_AUMMNE
..D ^DIC
..I $P(Y,U,3)=1 D
...S TOTNEW=TOTNEW+1
...D BMES^XPDUTL("Inserted Topic - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
...Q
..E D
...S AUMERR=AUMERR+1
...D BMES^XPDUTL("No Insert Performed - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
...Q
..D ^XBFMK
..Q
.Q
;
D BMES^XPDUTL("Total records processed: "_TOTCNT)
D BMES^XPDUTL("Total records already present: "_AUMERR)
D BMES^XPDUTL("Total records updated: "_TOTUPD)
D BMES^XPDUTL("Total records inserted: "_TOTNEW)
Q
KILL ;kill "B" cross-references
K ^AUTTEDMT("B")
Q
;
POST ;call to ENALL^DIK for .01 and 1
W !,"Rebuilding Indexes",!
S DIK="^AUTTEDMT("
S DIK(1)=".01^B"
D ENALL^DIK
S DIK(1)=".02^C"
D ENALL^DIK
Q
;
AUMAUTFX ;IHS/OIT/ABK - AUM 10 patch 2 AD-HOC LOAD [ 10/10/2010 9:19 AM ]
+1 ;;11.0;TABLE MAINTENANCE;**5**;Oct 15,2010
+2 ;Utilites to facilitate AUM/AUTT Fix
+3 ;
+4 ;
DOFTG(PATH,FILENAME) ;
+1 NEW GBL,GBLZISH,SUCCESS
+2 KILL ^TMP("AUMPFIX",$JOB)
+3 SET GBL="^TMP(""AUMPFIX"",$J)"
+4 SET GBLZISH="^TMP(""AUMPFIX"",$J,1)"
+5 SET GBLZISH=$NAME(@GBLZISH)
+6 SET SUCCESS=$$FTG^%ZISH(PATH,FILENAME,GBLZISH,3)
+7 QUIT
+8 ;
DOGTF(PATH,FILENAME) ;
+1 NEW GBL,GBLZISH,SUCCESS
+2 SET GBL="^TMP(""AUMPFIX"",$J)"
+3 SET GBLZISH="^TMP(""AUMPFIX"",$J,1)"
+4 SET GBLZISH=$NAME(@GBLZISH)
+5 SET SUCCESS=$$GTF^%ZISH(GBLZISH,3,PATH,FILENAME)
+6 QUIT
+7 ;
FIX ;
+1 NEW AUMDA,AUMDA1,TOTCNT,AUMERR,TOTUPD,FIXSTR,AUMCNAM,AUMMNE,AUMMJT
+2 SET AUMDA=""
SET TOTCNT=0
SET AUMERR=0
SET TOTUPD=0
+3 FOR
SET AUMDA=$ORDER(^TMP("AUMPFIX",$JOB,AUMDA))
IF AUMDA=""
QUIT
SET FIXSTR=^(AUMDA)
Begin DoDot:1
+4 SET TOTCNT=TOTCNT+1
+5 SET AUMCNAM=$PIECE(FIXSTR,U,4)_"-"_$PIECE(FIXSTR,U,5)
SET AUMMNE=$PIECE(FIXSTR,U,3)
SET AUMMJT=$PIECE(FIXSTR,U,4)
+6 ; Do error checking
+7 IF AUMCNAM=""
DO BMES^XPDUTL("Name field is null "_AUMCNAM_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+8 IF AUMMNE=""
DO BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+9 ; Ok - past that
+10 SET AUMDA1=0
SET AUMDA1=$ORDER(^AUTTEDT("C",AUMMNE,AUMDA1))
+11 ; DA NOT NULL,updating
IF AUMDA1'=""
Begin DoDot:2
+12 SET TOTUPD=TOTUPD+1
+13 ;,DIC(0)="L"
SET DIE="^AUTTEDT("
SET DA=AUMDA1
+14 SET DR=".01////"_AUMCNAM_";1////"_AUMMNE_";.06////"_AUMMJT_";.03////@"
+15 DO ^DIE
DO BMES^XPDUTL("Updated - Name = "_AUMCNAM_" Mnemonic = "_AUMMNE)
+16 DO ^XBFMK
+17 QUIT
End DoDot:2
+18 QUIT
End DoDot:1
+19 DO BMES^XPDUTL("Total records processed: "_TOTCNT)
+20 DO BMES^XPDUTL("Total records in error: "_AUMERR)
+21 DO BMES^XPDUTL("Total records updated: "_TOTUPD)
+22 QUIT
+23 ;
FIXAUM ;
+1 NEW AUMDA,AUMDA1,TOTCNT,AUMERR,TOTUPD,FIXSTR,AUMCNAM,AUMMNE,AUMMJT
+2 SET AUMDA=""
SET TOTCNT=0
SET AUMERR=0
SET TOTUPD=0
+3 FOR
SET AUMDA=$ORDER(^TMP("AUMPFIX",$JOB,AUMDA))
IF AUMDA=""
QUIT
SET FIXSTR=^(AUMDA)
Begin DoDot:1
+4 SET TOTCNT=TOTCNT+1
+5 SET AUMCNAM=$PIECE(FIXSTR,U,4)_"-"_$PIECE(FIXSTR,U,5)
SET AUMMNE=$PIECE(FIXSTR,U,3)
SET AUMMJT=$PIECE(FIXSTR,U,4)
+6 ; Do error checking
+7 IF AUMCNAM=""
DO BMES^XPDUTL("Name field is null "_AUMCNAM_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+8 IF AUMMNE=""
DO BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+9 ; Ok - past that
+10 SET AUMDA1=0
SET AUMDA1=$ORDER(^AUTTEDT("C",AUMMNE,AUMDA1))
+11 IF $DATA(^AUMPCLN(AUMMNE))
SET XSTR=^(AUMMNE)
SET $PIECE(XSTR,U,2)=AUMCNAM
SET $PIECE(XSTR,U,4)=AUMMJT
SET ^AUMPCLN(AUMMNE)=XSTR
SET TOTUPD=TOTUPD+1
+12 IF '$TEST
DO BMES^XPDUTL("Mnemonic - "_AUMMNE_" does not exist - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
+13 QUIT
End DoDot:1
+14 DO BMES^XPDUTL("Total records processed: "_TOTCNT)
+15 DO BMES^XPDUTL("Total records in error: "_AUMERR)
+16 DO BMES^XPDUTL("Total records updated: "_TOTUPD)
+17 QUIT
UPPER(X) QUIT $TRANSLATE(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
+1 ; End of routine
FIXSMT ; Fix Target AUTTEDMT data, translate to upper and remove apostrophes
+1 NEW X1,X2,X3,AUMDA
+2 SET AUMDA=0
+3 FOR
SET AUMDA=$ORDER(^AUTTEDMT(AUMDA))
IF AUMDA="B"
QUIT
SET X1=^(AUMDA,0)
SET X2=$TRANSLATE(X1,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
SET X3=$TRANSLATE(X2,"'")
SET ^AUTTEDMT(AUMDA,0)=X3
+4 QUIT
FIXEDMT ; Fix AUTTEDMT global, by updating it with new major topics
+1 NEW AUMDA,AUMDA1,TOTCNT,AUMERR,TOTNEW,TOTUPD,FIXSTR,AUMMNE,AUMMJT
+2 SET AUMDA=""
SET TOTCNT=0
SET AUMERR=0
SET TOTNEW=0
SET TOTUPD=0
+3 FOR
SET AUMDA=$ORDER(^AUMPMT(AUMDA))
IF AUMDA=""
QUIT
SET FIXSTR=^(AUMDA)
Begin DoDot:1
+4 SET TOTCNT=TOTCNT+1
+5 SET AUMMNE=$PIECE(FIXSTR,U,1)
SET AUMMJT=$PIECE(FIXSTR,U,2)
+6 ; Do error checking
+7 IF AUMMJT=""
DO BMES^XPDUTL("Topic Name field is null "_AUMMJT_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+8 IF AUMMNE=""
DO BMES^XPDUTL("Mnemonic field is null "_AUMMNE_" not updated - error")
DO BMES^XPDUTL("Record: "_FIXSTR)
SET AUMERR=AUMERR+1
QUIT
+9 ; Ok - past that
+10 SET AUMDA1=0
SET AUMDA1=$ORDER(^AUTTEDMT("B",AUMMNE,AUMDA1))
+11 ; DA NOT NULL,updating
IF AUMDA1'=""
Begin DoDot:2
+12 SET TOTUPD=TOTUPD+1
+13 ;,DIC(0)="L"
SET DIE="^AUTTEDMT("
SET DA=AUMDA1
+14 SET DR=".01////"_AUMMJT_";.02////"_AUMMNE
+15 DO ^DIE
DO BMES^XPDUTL("Updated - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
+16 DO ^XBFMK
+17 QUIT
End DoDot:2
+18 ; DA NULL,RECORD MISSING,SO WE ADD IT
IF AUMDA1=""
Begin DoDot:2
+19 SET X=AUMMJT
SET DIC="^AUTTEDMT("
SET DIC(0)="L"
+20 SET DIC("DR")=".02////"_AUMMNE
+21 DO ^DIC
+22 IF $PIECE(Y,U,3)=1
Begin DoDot:3
+23 SET TOTNEW=TOTNEW+1
+24 DO BMES^XPDUTL("Inserted Topic - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
+25 QUIT
End DoDot:3
+26 IF '$TEST
Begin DoDot:3
+27 SET AUMERR=AUMERR+1
+28 DO BMES^XPDUTL("No Insert Performed - Name = "_AUMMJT_" Mnemonic = "_AUMMNE)
+29 QUIT
End DoDot:3
+30 DO ^XBFMK
+31 QUIT
End DoDot:2
+32 QUIT
End DoDot:1
+33 ;
+34 DO BMES^XPDUTL("Total records processed: "_TOTCNT)
+35 DO BMES^XPDUTL("Total records already present: "_AUMERR)
+36 DO BMES^XPDUTL("Total records updated: "_TOTUPD)
+37 DO BMES^XPDUTL("Total records inserted: "_TOTNEW)
+38 QUIT
KILL ;kill "B" cross-references
+1 KILL ^AUTTEDMT("B")
+2 QUIT
+3 ;
POST ;call to ENALL^DIK for .01 and 1
+1 WRITE !,"Rebuilding Indexes",!
+2 SET DIK="^AUTTEDMT("
+3 SET DIK(1)=".01^B"
+4 DO ENALL^DIK
+5 SET DIK(1)=".02^C"
+6 DO ENALL^DIK
+7 QUIT
+8 ;