source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXXFI2.m@ 1535

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

initial load of FOIAVistA 6/30/08 version

File size: 5.5 KB
Line 
1LEXXFI2 ; ISL/KER - File Info - Checksums ; 07/28/2004
2 ;;2.0;LEXICON UTILITY;**32**;Sep 23, 1996
3 Q
4 ;
5 ; Global Variables
6 ; None
7 ;
8 ; External References
9 ; None
10 ;
11 Q
12ONE(X) ; Checksum for ONE file
13 N LEXENV S LEXENV=$$ENV^LEXXFI Q:+LEXENV'>0
14 N LEXFI,LEXFC,LEXMOD,LEXMUL,LEXNM,LEXTXT,LEXTT,LEXLDR,LEXTND
15 N LEXTSND,LEXTCS,LEXTSCS,LEXEX,LEXLINE,LEXCTLC
16 S (LEXTND,LEXTSND,LEXTCS,LEXTSCS,LEXMOD,LEXMUL)=0,LEXFI=$G(X) Q:+LEXFI'>0
17 S LEXLDR=$$LDR^LEXXFI8(LEXFI),LEXMOD=LEXMOD+($$MOD^LEXXFI8(LEXFI))
18 S LEXNM=$$FN^LEXXFI8(LEXFI),LEXTT=" "
19 D TT^LEXXFI8(LEXFI,"Checksum"),BL^LEXXFI8
20 D CS,CTLD,MF^LEXXFI8(LEXMOD),CTLD
21 Q
22ALL ; Checksum for ALL files
23 N LEXENV S LEXENV=$$ENV^LEXXFI Q:+LEXENV'>0
24 N LEXA,LEXCTR,LEXD,LEXEX,LEXF,LEXFC,LEXFI,LEXI,LEXLDR,LEXMOD,LEXMUL
25 N LEXN,LEXND,LEXP,LEXRTN,LEXT,LEXTAG,LEXTND,LEXTSND,LEXTCS,LEXTSCS,LEXU
26 S LEXMUL=1,(LEXTND,LEXTSND,LEXTCS,LEXTSCS,LEXMOD,LEXFC)=0
27 D TT^LEXXFI8("","Checksums"),BL^LEXXFI8
28 S LEXFI="",LEXTAG="FILES",LEXRTN="LEXXFI",LEXCTR=0
29 F D Q:LEXFI=""
30 . S LEXCTR=LEXCTR+1,LEXEX="S LEXLINE=$T("_LEXTAG_"+"_LEXCTR_"^"_LEXRTN_")"
31 . X LEXEX S LEXFI=$P(LEXLINE,";;",2,3) Q:'$L(LEXFI)
32 . S LEXLDR=$P(LEXFI,";;",1),LEXFI=$P(LEXFI,";;",2) Q:'$L(LEXFI)
33 . S LEXLDR=$S(+LEXLDR>0:" * ",1:" ")
34 . S:LEXLDR["*" LEXMOD=+($G(LEXMOD))+1 D CS
35 I +LEXTND>0 D
36 . I +($G(LEXTCS))>0,+($G(LEXTSCS))>0,+($G(LEXTND))>0,+($G(LEXTSND))>0 D
37 . . Q:+LEXTSND>LEXTND Q:+LEXTSCS>LEXTCS
38 . . D BL^LEXXFI8,TL^LEXXFI8(" Totals"),TL^LEXXFI8(" ------")
39 . . D TL^LEXXFI8($$FMT(" ","Static Files",LEXTSND,LEXTSCS))
40 . . D TL^LEXXFI8($$FMT(" * ","Variable Files",(LEXTND-LEXTSND),(LEXTCS-LEXTSCS)))
41 . . D TL^LEXXFI8($$FMT(" ","All Files",LEXTND,LEXTCS))
42 D MF^LEXXFI8(LEXMOD),CTLD
43 Q
44CS ; Checksum for File X
45 N LEXCS,LEXND,LEX S LEXFI=+($G(LEXFI)) Q:+LEXFI'>0
46 D DDI^LEXXFI6(+LEXFI,.LEX) Q:'$D(LEX("DIC",LEXFI,0,"GL")) Q:+LEXFI=757.09
47 S LEXLDR=$G(LEXLDR),LEXCS=$$CHECKSUM(LEXFI,.LEX),LEXND=+($P(LEXCS,"^",2)),LEXCS=+($P(LEXCS,"^",1))
48 S LEXTND=+($G(LEXTND))+LEXND,LEXTCS=+($G(LEXTCS))+LEXCS,LEXFC=+($G(LEXFC))+1
49 S:$G(LEXLDR)'["*" LEXTSCS=+($G(LEXTSCS))+LEXCS,LEXTSND=+($G(LEXTSND))+LEXND
50 D:LEXFC=1 TL^LEXXFI8($$FMT(" ","File #","Nodes",$S(+LEXMUL>0:"Checksums",1:"Checksum")))
51 D:LEXFC=1 TL^LEXXFI8($$FMT(" ","------------","----------","---------------"))
52 D TL^LEXXFI8($$FMT(LEXLDR,LEXFI,LEXND,LEXCS))
53 Q
54FMT(X,LEXFI,LEXND,LEXCS) ; Format Line
55 N LEXT S LEXT=$G(X)_$G(LEXFI) S LEXT=LEXT_$J("",(18-$L(LEXT)))_$J($G(LEXND),10)
56 S X=LEXT_$J("",(31-$L(LEXT)))_$J($G(LEXCS),15)
57 Q X
58CHECKSUM(X,LEX) ; Return CHECKSUM^NODES
59 N DIC,LEXC,LEXCNT,LEXCTR,LEXD,LEXE,LEXFI,LEXGCS,LEXN,LEXP,LEXRT,LEXT
60 N LEXTYP,LEXID,LEXRC,LEXIC,LEXCTL
61 S (LEXRC,LEXIC)=0
62 S LEXFI=+($G(X)) Q:+LEXFI'>0 "0^0" Q:'$D(LEX("DIC",LEXFI,0,"GL")) "0^0"
63 S DIC=$G(LEX("DIC",LEXFI,0,"GL")) Q:'$L(DIC) "0^0"
64 S LEXRT=$S(DIC[",":($E(DIC,1,($L(DIC)-1))_")"),1:$E(DIC,1,($L(DIC)-1))),LEXC=DIC
65 S LEXN=LEXRT,(LEXCNT,LEXCTR,LEXGCS)=0
66 F S LEXN=$Q(@LEXN) Q:LEXN=""!(LEXN'[LEXC) D
67 . S LEXCTR=LEXCTR+1,LEXD=@LEXN
68 . S LEXT=LEXN_"="_LEXD,LEXE=$L(LEXT)
69 . S LEXID=$P(LEXN,DIC,2,200)
70 . S:LEXID["," LEXID=$P(LEXID,",",1)
71 . S:LEXID[")" LEXID=$P(LEXID,")",1)
72 . S LEXTYP="UNK" S:+LEXID=LEXID LEXTYP="REC"
73 . S:+LEXID'=LEXID LEXTYP="IDX"
74 . S LEXCTL=$$CTL(LEXT) I +LEXCTL>0 D
75 . . Q:LEXTYP="UNK" N LEXTOT S LEXTOT=0
76 . . S:LEXTYP="REC" (LEXTOT,LEXRC)=LEXRC+LEXCTL
77 . . S:LEXTYP="IDX" (LEXTOT,LEXIC)=LEXIC+LEXCTL
78 . . S $P(LEXCTLC(+LEXFI,LEXTYP),"^",1)=$P($G(LEXCTLC(+LEXFI,LEXTYP)),"^",1)+1
79 . . S $P(LEXCTLC(+LEXFI,LEXTYP),"^",2)=LEXTOT
80 . ;
81 . F LEXP=1:1:LEXE S LEXGCS=$A(LEXT,LEXP)*LEXP+LEXGCS
82 S X=LEXGCS_"^"_LEXCTR D CTLC
83 Q X
84CTLD ; Control Characters (Display)
85 Q:$G(LEXCTLC(0))'>0
86 N LEXFI,LEXFIN,LEXFINC,LEXFII,LEXFIIC,LEXLN,LEXTH,LEXT1,LEXT2
87 S (LEXFI,LEXFIN,LEXFINC,LEXFII,LEXFIIC,LEXLN)=0
88 F S LEXFI=$O(LEXCTLC(LEXFI)) Q:+LEXFI=0 D
89 . S LEXFIN=$G(LEXCTLC(LEXFI,"REC"))
90 . S LEXFINC=$P(LEXFIN,"^",2),LEXFIN=$P(LEXFIN,"^",1)
91 . S LEXFII=$G(LEXCTLC(LEXFI,"IDX"))
92 . S LEXFIIC=$P(LEXFII,"^",2),LEXFII=$P(LEXFII,"^",1)
93 . S LEXTH=$$FN^LEXXFI8(LEXFI) Q:'$L(LEXTH)
94 . S LEXTH=" "_LEXTH_" file #"_LEXFI S (LEXT1,LEXT2)=""
95 . I LEXFIN>0,LEXFINC>0 D
96 . . S LEXT1=" "_$J(LEXFIN,4)_" Data Record"_$S(LEXFIN>0:"s",1:"")_" with "_LEXFINC_" control character"_$S(LEXFINC>0:"s",1:"")
97 . I LEXFII>0,LEXFIIC>0 D
98 . . S LEXT2=" "_$J(LEXFII,4)_" Cross-Reference entr"_$S(LEXFII>0:"ies",1:"y")_" with "_LEXFIIC_" control character"_$S(LEXFIIC>0:"s",1:"")
99 . Q:'$L(LEXT1)&('$L(LEXT2))
100 . S LEXLN=LEXLN+1 I LEXLN=1 D
101 . . D BL^LEXXFI8,TL^LEXXFI8(" Control Character(s) Found")
102 . . D TL^LEXXFI8(" =========================="),BL^LEXXFI8
103 . D TL^LEXXFI8(LEXTH)
104 . D:$L(LEXT1) TL^LEXXFI8(LEXT1)
105 . D:$L(LEXT2) TL^LEXXFI8(LEXT2)
106 Q
107CTL(X) ; Control Characters
108 N TXT S TXT=$G(X)
109 N I,CHR S X=0 F I=1:1 S CHR=$E($G(TXT),I) Q:'$L(CHR) D
110 . I $A(CHR)<32!($A(CHR)>126) S X=X+1
111 Q X
112CTLC ; Control Character Array
113 N LEXFI,LEXND,LEXCC,LEXFIC,LEXNDC,LEXCCC
114 S (LEXFI,LEXND,LEXCC,LEXFIC,LEXNDC,LEXCCC)=0
115 F S LEXFI=$O(LEXCTLC(LEXFI)) Q:+LEXFI=0 D
116 . S LEXFIC=LEXFIC+1,(LEXNDC,LEXCCC)=0
117 . S LEXND=$P($G(LEXCTLC(LEXFI,"REC")),"^",1)
118 . S LEXCC=$P($G(LEXCTLC(LEXFI,"REC")),"^",2)
119 . S LEXNDC=LEXNDC+LEXND,LEXCCC=LEXCCC+LEXCC
120 . S LEXND=$P($G(LEXCTLC(LEXFI,"IDX")),"^",1)
121 . S LEXCC=$P($G(LEXCTLC(LEXFI,"IDX")),"^",2)
122 . S LEXNDC=LEXNDC+LEXND,LEXCCC=LEXCCC+LEXCC
123 . S LEXCTLC(LEXFI,0)=LEXNDC_"^"_LEXCCC
124 . S LEXCTLC(0)=LEXFIC
125 Q
126TT ;
127 S LEXCTLC(0)=1
128 S LEXCTLC(80,0)="43^43"
129 S LEXCTLC(80,"IDX")="12^14"
130 S LEXCTLC(80,"REC")="8^10"
131 S LEXCTLC(81,0)="43^43"
132 S LEXCTLC(81,"IDX")="20^28"
133 S LEXCTLC(81,"REC")="23^26"
134 Q
Note: See TracBrowser for help on using the repository browser.