source: FOIAVistA/trunk/r/LEXICON_UTILITY-LEX-GMPT/LEXXFI4.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: 4.7 KB
Line 
1LEXXFI4 ; ISL/KER - File Info - Record Counts (2) ; 07/28/2004
2 ;;2.0;LEXICON UTILITY;**32**;Sep 23, 1996
3 Q
4 ;
5 ; Global Variables
6 ; ^TMP("LEXCNT",$J SACC 2.3.2.5.1
7 ;
8 ; External References
9 ; DBIA 10103 $$FMDIFF^XLFDT
10 ;
11DSP ; Display Results
12 N LEXFP,LEXCT,LEXFI,LEXGTOT,LEXHSF,LEXJOB,LEXMD,LEXX,LEXLVL,LEXML
13 N LEXNCFI,LEXNFI,LEXNPAR,LEXOPAR,LEXO,LEXPAR,LEXTAB,LEXTXT
14 S (LEXCT,LEXGTOT,LEXML)=0,LEXOPAR=""
15 S LEXJOB=$J S:+($G(LEXMD))>0 LEXJOB=+($G(LEXMD))
16 K:$D(LEXMD) LEXMD S LEXFP="" S LEXFP=""
17 F S LEXFP=$O(^TMP("LEXCNT",LEXJOB,"ORDER",LEXFP)) Q:LEXFP="" D
18 . S LEXO=""
19 . F S LEXO=$O(^TMP("LEXCNT",LEXJOB,"ORDER",LEXFP,LEXO)) Q:LEXO="" D
20 . . N LEXFI,LEXPAR,LEXLVL,LEXTAB,LEXTXT,LEXHSF,LEXX
21 . . S LEXTAB="",LEXHSF=0
22 . . S LEXPAR=$G(^TMP("LEXCNT",LEXJOB,"ORDER",LEXFP,LEXO))
23 . . S LEXFI=+($P(LEXPAR,"^",2)),LEXLVL=+($P(LEXPAR,"^",3))
24 . . S LEXPAR=+($P(LEXPAR,"^",1)) Q:LEXPAR=0
25 . . S LEXNFI=$O(^TMP("LEXCNT",LEXJOB,LEXPAR,LEXPAR))
26 . . S:LEXNFI>0&(LEXNFI'=LEXPAR) LEXHSF=1
27 . . S LEXX=$G(^TMP("LEXCNT",LEXJOB,LEXPAR,LEXFI)),LEXCT=LEXCT+1
28 . . S LEXNPAR=$O(^TMP("LEXCNT",LEXJOB,"ORDER",LEXFP,LEXO))
29 . . S LEXNPAR=$P(LEXNPAR,";",1)
30 . . S LEXNCFI=$O(^TMP("LEXCNT",LEXJOB,"ORDER",LEXFP))
31 . . I '$L(LEXNPAR),$L(LEXNCFI) S LEXML=1
32 . . I LEXCT=1 D TTL,HDR
33 . . I +LEXFI>0 D TSF
34 . . I +LEXFI'>0,+($G(LEXHSF))>0 D GTSF
35 D GT,CK
36 Q
37TSF ; Total for a Single File/Sub-File
38 N LEXNM,LEXTAB,LEXTOT,LEXTXT,LEXTYP
39 S LEXX=$G(LEXX),LEXTOT=+LEXX,LEXNM=$P(LEXX,"^",2)
40 S LEXTYP=$P(LEXX,"^",3),LEXTAB=""
41 Q:+LEXTOT'>0 Q:'$L(LEXNM) Q:'$L(LEXTYP)
42 S $P(LEXTAB," ",(+($G(LEXLVL))*2))=""
43 S LEXTXT=" "_LEXTAB_LEXNM_" ("_LEXTYP_")"
44 S LEXTXT=LEXTXT_$J("",(60-$L(LEXTXT)))_$J(LEXTOT,9)
45 S LEXGTOT=+($G(LEXGTOT))+LEXTOT D TL^LEXXFI8(LEXTXT)
46 Q
47GTSF ; Grand Total for a Single File
48 N LEXLVL,LEXNM,LEXTAB,LEXTOT,LEXTXT,LEXTYP,LEXX
49 S LEXX=$G(^TMP("LEXCNT",LEXJOB,LEXPAR,LEXPAR)),LEXLVL=+($$ML)+2
50 S LEXNM=$P(LEXX,"^",2),LEXTYP=$P(LEXX,"^",3) Q:'$L(LEXNM) Q:'$L(LEXTYP)
51 S LEXTAB="",LEXX=$G(^TMP("LEXCNT",LEXJOB,LEXPAR,0))
52 S LEXTOT=+LEXX,$P(LEXTAB," ",(LEXLVL*2))=""
53 S LEXTXT=" "_LEXTAB_" - Total Records for "_LEXTYP
54 S LEXTXT=LEXTXT_$J("",(60-$L(LEXTXT)))_$J(LEXTOT,9)
55 D TL^LEXXFI8(LEXTXT)
56 Q
57GT ; Grand Totals for Multiple Files
58 N LEXCT,LEXFI,LEXTXT S LEXCT=0,LEXFI="" I +($G(LEXGTOT))>0,+($G(LEXML))>0 D
59 . D BL^LEXXFI8 S LEXTXT=" GRAND TOTAL (ALL FILES) "
60 . S LEXTXT=LEXTXT_$J("",(50-$L(LEXTXT)))_$J(LEXGTOT,19) D TL^LEXXFI8(LEXTXT)
61 Q
62TTL ; Record Count Title
63 D:+($G(LEXMUL))>0 TT^LEXXFI8("","Record Counts")
64 D:+($G(LEXMUL))'>0 TT^LEXXFI8($G(LEXFI),"Record Count")
65 D BL^LEXXFI8
66 Q
67HDR ; Record Count Header
68 N LEXTXT S LEXTXT=" Name (File Number)"
69 S LEXTXT=LEXTXT_$J("",(60-$L(LEXTXT)))_$J("Entries",9) D TL^LEXXFI8(LEXTXT)
70 S LEXTXT=" -------------------------------------------------"
71 S LEXTXT=LEXTXT_$J("",(60-$L(LEXTXT)))_$J("-------",9) D TL^LEXXFI8(LEXTXT)
72 Q
73CK ; Records Checked
74 N LEXF,LEXS,LEXFT,LEXST,LEXJ S LEXJ=$S(+($G(LEXJOB))>0:+($G(LEXJOB)),1:$J)
75 S LEXF=+($G(^TMP("LEXCNT",LEXJ,"CNT")))
76 S LEXFT=$S(LEXF=1:"1 File",LEXF>1:(LEXF_" Files"),1:"")
77 S LEXS=+($G(^TMP("LEXCNT",LEXJ,"SUB")))
78 S LEXST=$S(LEXS=1:"1 Sub-File",LEXS>1:(LEXS_" Sub-Files"),1:"")
79 I (LEXF+LEXS)>1 D
80 . S LEXTXT=" " S:$L(LEXFT) LEXTXT=LEXTXT_LEXFT
81 . S:$L(LEXFT)&($L(LEXST)) LEXTXT=LEXTXT_" and "_LEXST
82 . S:'$L(LEXFT)&($L(LEXST)) LEXTXT=LEXTXT_LEXST
83 . I $L(LEXFT)!($L(LEXST)) S LEXTXT=LEXTXT_" Checked" D
84 . . D BL^LEXXFI8,TL^LEXXFI8(LEXTXT)
85 Q
86ML(X) ; Maximum Level
87 N LEXJ S LEXJ=$S(+($G(LEXJOB))>0:+($G(LEXJOB)),1:$J)
88 S X=+($G(^TMP("LEXCNT",LEXJ,"LVL"))) S:+X'>0 X=1
89 Q X
90NF(X) ; Number of Files
91 N LEXJ S LEXJ=$S(+($G(LEXJOB))>0:+($G(LEXJOB)),1:$J)
92 S X=+($G(^TMP("LEXCNT",LEXJ,"CNT")))
93 Q X
94NS(X) ; Number of Sub-Files
95 N LEXJ S LEXJ=$S(+($G(LEXJOB))>0:+($G(LEXJOB)),1:$J)
96 S X=+($G(^TMP("LEXCNT",LEXJ,"SUB")))
97 Q X
98ST ; Show TMP Array
99 N NN,NC S NN="^TMP(""LEXCNT"")",NC="^TMP(""LEXCNT"","
100 F S NN=$Q(@NN) Q:NN=""!(NN'[NC) D
101 . W !,NN,"=",@NN
102 Q
103EP(X,Y) ; Elapsed Time (Begin, End)
104 N LEXTIM,LEXBEG,LEXEND
105 S LEXBEG=$G(X),LEXEND=$G(Y) Q:+LEXBEG'>0 "" Q:+LEXEND'>0 ""
106 S LEXTIM=$$FMDIFF^XLFDT(LEXEND,LEXBEG,2) Q:+LEXTIM'>0 "00:00:00"
107 S LEXTIM=$$TIM(LEXTIM)
108 Q LEXTIM
109TIM(X) ; Format Time Elapsed
110 N LEXD,LEXH,LEXM,LEXS,LEXT,LEXV S X=+($G(X)) Q:X'>0 "00:00:00"
111 S LEXD=X\86400 S LEXV=LEXD*86400 S:+LEXV>0&(LEXV<X) X=X-LEXV
112 S LEXH=X\3600 S LEXV=LEXH*3600 S:+LEXV>0&(LEXV<X) X=X-LEXV
113 S:$L(LEXH)<2 LEXH="0"_LEXH S:$L(LEXH)<2 LEXH="0"_LEXH
114 S LEXM=X\60 S LEXV=LEXM*60 S:+LEXV>0&(LEXV<X) X=X-LEXV
115 S:$L(LEXM)<2 LEXM="0"_LEXM S:$L(LEXM)<2 LEXM="0"_LEXM
116 S LEXS=X S:$L(LEXS)<2 LEXS="0"_LEXS S:$L(LEXS)<2 LEXS="0"_LEXS
117 S LEXT="" S:+LEXD>0 LEXT=+LEXD_" day"_$S(+LEXD>1:"s",1:"")_" "
118 S LEXT=LEXT_LEXH_":"_LEXM_":"_LEXS,X=LEXT
119 Q X
Note: See TracBrowser for help on using the repository browser.