source: WorldVistAEHR/trunk/r/TOOLKIT-AWCM-XD-XIN-XPAR-XQAB-XT-XUC-XUR-ZIN-ZTED/XTRUTL.m@ 1211

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

initial load of WorldVistAEHR

File size: 4.9 KB
RevLine 
[613]1XTRUTL ;ISCSF/RWF - Developer Routine Utilities ;3/21/2006 2:50PM
2 ;;7.3;TOOLKIT;**20,39,59,66,76,100**;Apr 25, 1995;Build 4
3 ;
4 Q ;No entry from the top.
5BUILD ;
6 K ^UTILITY($J),^TMP($J) D HOME^%ZIS
7 N BLDA,DIC,IX,X,PATCH,RTN,RN,L2,OLDSUM,OON
8 W !!,"This generates the Checksum/2nd line list for the routines from a BUILD file."
9 I '$D(^XPD(9.6,0)) W !,"No BUILD file to work from." Q
10 S Y=$$BUILD^XTRUTL1 G EXIT:Y'>0 S BLDA=+Y,PATCH=+$P(Y,"*",3)
11 D RTN^XTRUTL1(BLDA)
12 I '$D(^UTILITY($J)) W !,"No routines in this build." G EXIT
13 ;Ask about old/new checksums
14 S OON=$$ASKOON Q:OON<1 ;Return 1 or 2
15 ;S X=$P(^DIC(9.4,+$P(Y(0),U,2),0),U,2)
16 S RN="" F S RN=$O(^UTILITY($J,RN)) Q:RN="" D Q:$D(L2)
17 . S X=RN X ^%ZOSF("TEST") I '$T D Q
18 . . W !,RN,?13,"Routine not in this UCI."
19 . . K ^UTILITY($J,RN)
20 . S L2=$T(+2^@RN)
21 I '$D(L2) W !,"No other routines in this build." G EXIT
22 S L2=$P(L2,";",1,4)_";**[Patch List]**;"_$P(L2,";",6,99)
23 W !!,"Routine Summary"
24 W !,"Checksums shown are "_$S(OON=1:"OLD",1:"NEW")_" Checksums"
25 W !,"The following routines are included in this patch. The second line of each",!,"of these routines now looks like:"
26 W !,L2
27 W !!,?17,"Checksums",!,"Routine",?16,"Old",?28,"New",?39,"Patch List"
28 S RN=""
29 F S RN=$O(^UTILITY($J,RN)) Q:RN="" D
30 . S RSUM=$P($$NEWSUM(RN),"/",OON) ;rwf
31 . S OLDSUM=$$OLDSUM(RN),OLDSUM=$P(OLDSUM,"/",OON) ;rwf
32 . S X=$G(RTN(2,0)) ;X has second line of routine
33 . S:(+OLDSUM=0) OLDSUM="n/a " S:(+RSUM=0) RSUM="n/a "
34 . W !,RN,?13,$J(OLDSUM,8),?25,$J(RSUM,8) D WRAP(37,$P(X,";",5))
35 . D PTLBLD($P(X,";",5))
36 . S Y=$P(X,"**",2),Z=$P(Y,",",$L(Y,","))
37 . I PATCH,Z'=PATCH W " <<<No "_PATCH
38 . Q
39 W ! D PTLDSP
40 W !,"Sites should use CHECK"_$S(OON=2:"1",1:"")_"^XTSUMBLD to verify checksums.",!
41EXIT K %
42 Q
43 ;
44ASKOON() ;Ask if user wants old/new checksum
45 ;Return 1 or 2.
46 N DIR,DIOUT
47 S DIR(0)="S^1:Old;2:New",DIR("A")="New or Old Checksums",DIR("B")="New"
48 D ^DIR
49 I $D(DIRUT) S Y=-1
50 Q Y
51 ;
52WRAP(C,S) ;Wrap S starting at col C.
53 I $L(S)+C<80 W ?C,S Q
54 N I,T
55 S I=$F(S,",",70-C) W ?C,$E(S,1,I-1) S S=$E(S,I,999)
56 F S I=$F(S,",",70-C),I=$S(I>0:I,1:$L(S)+2) W !,?C+2,$E(S,1,I-1) S S=$E(S,I,999) Q:'$L(S)
57 Q
58 ;
59RSUM() N Y,Y2,%,%1,%2,%3 S (Y,Y2)=0
60 F %=1,3:1:LC S %1=RTN(%,0),%3=$F(%1," "),%3=$S($E(%1,%3)'=";":$L(%1),$E(%1,%3+1)=";":$L(%1),1:%3-2) F %2=1:1:%3 S Y=$A(%1,%2)*%2+Y,Y2=$A(%1,%2)*(%2+%)+Y2
61 ;S RSUM=Y,RSUM2=Y2
62 Q Y_"/"_Y2
63 ;
64NEWSUM(X) ;Get the NEW Checksum
65 N XCNP,DIF K RTN I '$L($T(^@X)) Q 0
66 S XCNP=0,DIF="RTN(" K RTN X ^%ZOSF("LOAD") S LC=XCNP-1
67 Q $$RSUM
68 ;
69OLDSUM(X) ;Get the OLD Checksum
70 N Y S Y=$O(^DIC(9.8,"B",X,0)) Q:Y'>0 ""
71 S X=$G(^DIC(9.8,Y,4))
72 Q $P(X,"^",2)
73 ;
74PTLBLD(Z) ;Build in ^TMP the patches used
75 N I,J,K,P S Z=$P(Z,"**",2),K=""
76 F I=1:1 S J=$P(Z,",",I) Q:(J="") I (J'=PATCH) S P=$G(^TMP($J,J)),^TMP($J,J)=P_K S K=K_J_","
77 Q
78PTLSRT ;Sort the list
79 N I,J,K,L S I=0
80 F I=0:0 S I=$O(^TMP($J,I)) Q:I'>0 S K=^(I) D
81 . F J=1:1 S L=$P(K,",",J) Q:L="" K ^TMP($J,L)
82 . Q
83 Q
84 ;
85PTLDSP ;Display list of patches.
86 D PTLSRT
87 N I,J K ^TMP($J,PATCH)
88 Q:$O(^TMP($J,0))=""
89 W !,"List of preceding patches: "
90 S (I,J)="" F S I=$O(^TMP($J,I)) Q:I="" D
91 . I $X>70 W ! S J=""
92 . W J,I S J=", "
93 S:$L(J)>2 J=$E(J,1,$L(J)-2)
94 Q
95 ;
96UPDATE ;Update the ROUTINE file with current checksums
97 K ^UTILITY($J)
98 N BLDA,DIC,IX,X,NOW,DIR
99 W !!,"This will update the ROUTINE file for the routines from a BUILD file."
100 I '$D(^XPD(9.6,0)) W !,"No BUILD file to work from." Q
101 S Y=$$BUILD^XTRUTL1 G EXIT:Y'>0 S BLDA=+Y
102 S DIR(0)="Y",DIR("A")="Is "_$P(Y,U,2)_" the one you want" D ^DIR
103 I $D(DIRUT)!(Y'=1) Q
104 D RTN^XTRUTL1(BLDA)
105 S NOW=$$NOW^XLFDT()
106 G EXIT:$O(^UTILITY($J,""))=""
107 S RN=""
108 F S RN=$O(^UTILITY($J,RN)) Q:RN="" D UD1(RN)
109 W !,"Done"
110 Q
111 ;
112UD1(RN) ;
113 N X,XCNP,DIF,LC,RSUM,Y S:'$D(NOW) NOW=$$NOW^XLFDT
114 S U="^",RSUM=$$NEWSUM(RN) Q:RSUM=0
115 S X=RTN(2,0)
116 S Y=$$GETDA(RN) I Y'>0 W !," Routine ",RN," not found in the database." Q
117 I '$$LOCAL(Y) W !,"This is a national routine and will not be updated" Q
118 S ^DIC(9.8,+Y,4)=NOW_U_RSUM_U_$P(X,";",5)
119 Q
120 ;
121SHOW(RN) ;Show current data
122 N Y,%0,%4,RTN,RSUM S %4="^n/a^n/a",U="^"
123 S Y=$$GETDA(RN) I Y>0 S %0=^DIC(9.8,Y,0),%4=$G(^(4))
124 S RSUM=$$NEWSUM(RN)
125 W !,"RTN",?10,"New ChkSum",?28,"Old ChkSum",?46,"Old Date"
126 W !,RN,?10,RSUM,?28,$P(%4,U,2),?46,$P(%4,U)
127 W !,$S($$LOCAL(Y):"Local",1:"National")_" Routine"
128 Q
129 ;
130GETDA(X) ;Find a DA in file
131 Q $O(^DIC(9.8,"B",X,0))
132 ;
133M ;Manual Update of the Routine file
134 N DIC,DIE,DA,DR
135 S DIC="^DIC(9.8,",DIC(0)="AEMQ" D ^DIC Q:Y'>0
136 I '$$LOCAL(+Y) W !,"This routine Checksum only updated from FORUM." Q
137 S DA=+Y,DIE=DIC,DR=7.2 D ^DIE
138 Q
139 ;
140LIST ;List all routines that don't match the old checksum
141 N Y,X,RN,RSUM,DA
142 S RN="",U="^"
143 F S RN=$O(^DIC(9.8,"B",RN)) Q:RN="" D
144 . S DA=$O(^DIC(9.8,"B",RN,0)) Q:DA'>0
145 . S %4=$G(^DIC(9.8,DA,4)) Q:$P(%4,U,2)="" S RSUM=$$NEWSUM(RN)
146 . I RSUM'=$P(%4,U,2) W !,RN,?10,"Checksum mismatch ",$P($T(+2^@RN),";",5)
147 . Q
148 Q
149 ;
150LOCAL(DA) ;Return if this is a local routine in the ROUTINE file.
151 Q $P($G(^DIC(9.8,DA,6)),"^")<2
152 ;
Note: See TracBrowser for help on using the repository browser.