source: FOIAVistA/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZTBKCMSM.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1%ZTBKC1 ;SFISC/GJL,AC - MSM BLOCK COUNT ;1/22/90 18:21
2 ;;8.0;KERNEL;;JUL 10, 1995
3 S %D=$P($ZU(""),",",2),%O=+$ZU(""),%O=0,%D="G"_%D
4 O 63::5 E W !,$C(7),"The VIEW device is busy!",$C(7),!! Q
5 S %G=$P(X,"("),%B=$ZBN(@("^"_%G)),%N="",%T=0 G MSMPTBK
6MSMGD ;FIND GLOBAL DIRECTORY
7 G EXIT
8MSMPTBK V %B:%D S (%H,%J,%L,%O)=0,%E=$V(1022,0,2) S %TYPE=$V(1020,0,1)#128 I %TYPE=3!(%TYPE=4) G MSMDATA
9 ;
10MSMPTLP I %O<%E G MSMPTNT
11 S %B=$V(1012,0,4) I %B=0 S %B=%L
12 I %B G MSMPTBK
13 G EXIT
14MSMPTNT D MSMNODE I %I=2 D MSMPTDW S %O=%O+3 G MSMPTLP
15 I %I=1,%L=0 D MSMPTDW
16 S %B=%L G MSMPTBK
17MSMPTDW S %L=$V(%O,0,3) Q
18 ;
19MSMDTBK V %B:%D S %O=0,%E=$V(1022,0,2),%T=%T+1,%J=0
20 ;
21MSMDATA I %O<%E G MSMDTNT
22 S %B=$V(1012,0,4) I %B G MSMDTBK
23 G EXIT
24MSMDTNT S %J=%J+1 D MSMNODE I %I=1 S:%H=0 %T=%T+1 S %H=1,%O=%E G MSMDATA ;Next BLK
25 I %I'=2 S:%J=1 %T=%T-1 G EXIT
26 S %I=$V(%O,0,1) I '%I S %O=%O+5 G MSMDATA ;G 0:'%I
27 S %I=$S(%I=3!(%I=8):$V(%O+1,0,1),1:-1),%O=%O+%I+2 G MSMDATA
28MSMNODE S %C=$V(%O,0,1),%W=$V(%O+1,0,1),%O=%O+2
29 S %I=%O,%K="" I %C=0 S %K=%G,%I=%I+$L(%G)
30 ;
31 F %I=%I:1:%O+%W I %I<(%O+%W) S %Z=$V(%I,0,1),%K=%K_$C(%Z#256)
32 S %O=%I,%N=$E(%N,0,%C)_%K,%F=$E(%N,$L(%G)+1,256),%M="",%I=0
33MSMPROC S %I=%I+1 I %I>$L(%F) G MSMTSTN
34 S %V=$A(%F,%I) I %V=0 S %M=%M_"," G MSMPROC
35 I %V=255 S %I=%I+1 G MSMASCI:$A(%F,%I),MSMPROC
36 I %V>127 S %I=%I+1,%S="",%V=%V-128 G MSMPOS:$A(%F,%I),MSMPROC
37 I %V=127 S %M=%M_"0" G MSMPROC
38 I %V<127 S %M=%M_"-",%S="",%V=126-%V G MSMNEG
39 W !,"ERROR",$C(7),$C(7) G MSMPROC
40MSMASCI S %M=%M_$E(%F,%I) I $A(%F,%I+1) S %I=%I+1 G MSMASCI ;Also zero & pos
41 G MSMPROC
42MSMPOS S %S=%S_$E(%F,%I) I $A(%F,%I+1) S %I=%I+1 G MSMPOS
43 I %V<$L(%S) S %S=$E(%S,0,%V)_"."_$E(%S,%V+1,256)
44 S %M=%M_%S G MSMPROC
45 G MSMPOS
46MSMNEG S %I=%I+1 I $A(%F,%I)'=255 S %S=%S_$C(105-$A(%F,%I)) G MSMNEG
47 I %V<$L(%S) S %S=$E(%S,0,%V)_"."_$E(%S,%V+1,256)
48 S %M=%M_%S
49 G MSMPROC
50MSMTSTN S %M=$E(%M,2,$L(%M)),%S=$P(X,"(",2),%S=$P(%S,")",1) I (%S="")!(%S=%M) S %I=1 Q
51MSMTSTL S %X=$P(%S,",",1),%Y=$P(%M,",",1) I +%X'=%X G MSMSTR
52 I %Y="" S %I=2 Q
53 I +%Y'=%Y S %I=3 Q
54 I %X>%Y S %I=2 Q
55 I %X<%Y S %I=3 Q
56MSMTSTC S %S=$P(%S,",",2,$L(%S)) I %S="" S %I=1 Q
57 S %M=$P(%M,",",2,$L(%M)) I %M="" S %I=2 Q
58 G MSMTSTL
59MSMSTR I +%Y=%Y S %I=2 Q
60 I %X]%Y S %I=2 Q
61 I %X'=%Y S %I=3 Q
62 G MSMTSTC
63ALL ;Entry point for block count of all globals.
64 O 63::2 E W !,"The VIEW device is busy.",$C(7) Q
65 K ^UTILITY("%ZTBKC",$J) X ^%ZOSF("UCI") W !!,Y," " S %SK=$X+1 W "Globals",?(%SK+12),"Data Blocks"
66 W ?(%SK+34) D NOW^%DTC S X=%,%DT="ET" D ^%DT W !
67 S %D=$P($ZU(""),",",2),%O=+$ZU("")
68 S %A=$V(44),%S=$V(%A+8,-3,2)+%A,%VT=$V(40+%S)
69 S %UT=$V($V(%D*4+%VT)+20),%D="G"_%D
70 S %B=$V(%O-1*32+%UT+4,-3,4),%N="",(%C,%W)=0
71AMSMVUE V %B:%D S %G="",%E=$V(1022,0,2),%O=$S($V(0,0,1)=0:13,1:0)
72AMSMNXT G AMSMPTR:%E'>%O
73 S %C=$V(%O,0,1),%W=$V(%O+1,0,1),%G=$E(%N,1,%C),%O=%O+2
74AMSMLOP S %Z=$V(%O,0,1),%O=%O+1 S:%Z#256 %G=%G_$C(%Z#256) G AMSMLOP:%Z
75 S ^UTILITY("%ZTBKC",$J,%G)="",%O=%O+11,%N=%G,%G="" G AMSMNXT
76AMSMPTR S %B=$V(1012,0,4) I %B G AMSMVUE
77 C 63 K %VT
78 S (%TOT,%GLO)=0 F %II=1:1 S X=$O(^UTILITY("%ZTBKC",$J,%GLO)),%GLO=X Q:X="" W !,?%SK,X,?(%SK+15) S:X?1"^".E X=$E(X,2,255) S %T=-1 D %ZTBKC1 S X=%T S:X>0 %TOT=%TOT+X W:X<0 "-- no such global --" W:X'<0 X
79 W !!?%SK,"Total",?(%SK+15),%TOT K %GLO,%II,%SK,%TOT,X,^UTILITY("%ZTBKC",$J)
80EXIT C 63 K %A,%B,%C,%D,%E,%F,%G,%H,%I,%J,%K,%L,%M,%N,%O,%S,%TYPE,%UT,%V,%W,%X,%Y,%Z
Note: See TracBrowser for help on using the repository browser.