Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DI14POST

DI14POST.m

Go to the documentation of this file.
  1. DI14POST ;OAK/RSD Post Install for patch 14
  1. ;;22.2;VA FileMan;**14**;Jan 05, 2016;Build 8
  1. ;resave DIDT to %DT ICR #6212
  1. N %D,%S,SCR,ZTOS
  1. S SCR="I 1",%S="DIDT",%D="%DT",ZTOS=$$OSNUM^ZTMGRSET()
  1. D MOVE^ZTMGRSET
  1. ;
  1. ;setup ^DD(.114 nodes, change 240 to 999
  1. S ^DD(.114,6,0)="MAXIMUM LENGTH^NJ3,0^^0;5^K:+X'=X!(X>999)!(X<1)!(X?.E1"".""1N.N) X"
  1. S ^DD(.114,6,3)="Answer must be between 1 and 999, with no decimal digits. Answer '??' for more help."
  1. Q
  1. ;
  1. EN ;find all sub data dictionaries and check zero node name
  1. N DIR,I,J,K,X,Y
  1. W !!,"This will check your account for bad ^DD(file #,0) nodes. It will look"
  1. W !,"for multiples that don't have the field name as the 1st piece of the node."
  1. W !,"It will display its results and ask you if you want to make the changes."
  1. W !,"This will take 5 to 10 minutes."
  1. I $G(^XTMP("DI14","C")) D
  1. . W !!,"You already have bad nodes identified in the ^XTMP(""DI14"") global."
  1. . W !,"If you proceed this data will be overwritten."
  1. W !!,"Do you want to run the check?"
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR
  1. Q:'Y
  1. K ^XTMP("DI14")
  1. W !,".."
  1. ;reset expiration date to T+30 on transport global and "C"=count node
  1. S ^XTMP("DI14",0)=$$FMADD^XLFDT(DT,30)_U_DT,^XTMP("DI14","C")=0,I=1
  1. ;if zero node contains 'FIELD', check if a file
  1. F S I=$O(^DD(I)) Q:'I S J=$G(^DD(I,0)) I $P(J,U)="FIELD" D
  1. . I $G(^DIC(I,0))]"",$G(^DIC(I,0,"GL"))]"" Q ;this is a file
  1. . S K=$O(^DD(I,0,"NM","")) Q:K="" ;get subfield name
  1. . S $P(J,U)=K_$S($G(^DD(I,0,"UP")):" SUB-FIELD",1:"") D REC("S","^DD("_I_",0)",J) ;set subfield name back on the zero node
  1. . Q
  1. S J=$G(^XTMP("DI14","C")) W !
  1. I 'J W !,"No bad nodes",! Q
  1. F I=1:1 S X=$G(^XTMP("DI14",I)) W !,$P(X,U,2) Q:I=J
  1. W !!,J," bad node(s) found. Do you want to repair?"
  1. S DIR(0)="Y",DIR("B")="NO" D ^DIR
  1. Q:'Y
  1. D EXEC W !!,"Done",!
  1. Q
  1. ;
  1. ;
  1. REC(X,Y,Z) ;record action X, global ref. Y, new value for set Z
  1. ;^XTMP("DI14",n)=action^global ref^new value
  1. N C ;subscript counter
  1. S C=^XTMP("DI14","C")+1,^("C")=C
  1. I X="S" S ^XTMP("DI14",C)="S"_Y_"^"_$G(Z) Q
  1. Q
  1. ;
  1. EXEC ;execute the changes found
  1. I '$G(^XTMP("DI14",0)) W !!,"Backup Global, ^XTMP(""DI14""), doesn't exists !!" Q
  1. N I,X,Y
  1. S I=0
  1. F S I=$O(^XTMP("DI14",I)) Q:'I D
  1. . S X=$G(^XTMP("DI14",I)),Y=$P(X,U,2)
  1. . I $E(X)="S" S @("^"_Y)=$P(X,U,3,6) Q
  1. . Q
  1. Q
  1. ;
  1. RESTORE ;restore the old values in ^XTMP("DI14")
  1. I '$G(^XTMP("DI14",0)) W !!,"Backup Global, ^XTMP(""DI14""), doesn't exists !!" Q
  1. N I,X,Y
  1. S I=0
  1. F S I=$O(^XTMP("DI14",I)) Q:'I D
  1. . S X=$G(^XTMP("DI14",I)),Y=$P(X,U,2)
  1. . ;restore old set value, 1st piece is always "FIELD"
  1. . I $E(X)="S" S @("^"_Y)="FIELD^"_$P(X,U,4,6) Q
  1. . Q
  1. Q