cQSCGS(a,b,c,d) ;Scan global size ;cQSCGS; W !,"D START^cQSCGS" W !,"or" W !,"D START^cQSCGS(Dbase,File,10,60)",! Q START(Dbase,File,Interval,Iterations) ;Scan size of globals within dbase and write the result in file ; Launch with a command DO or JOB syntax: ; Directory path of the database to be scanned S Directory=$G(Dbase,$P($ZU(86),"\",1,$L($ZU(86),"\")-1)_"\mgr\cachetemp") I $E(Directory,$L(Directory))="\" S Directory=$E(Directory,1,$L(Directory)-1) ; Filename of the generated log file with the global file sizes S file=$G(File,$P($ZU(86),"\",1,2)_"\temp\GlobalSizes_"_$P(Directory,"\",$L(Directory,"\"))_".txt") ; Minimum global size that should be included in the generated report, in MB S tab=$C(9),minSize=10,Interval=$G(Interval),Iterations=$G(Iterations) S $ZT="ERROR" D HEAD S:'Interval Interval=60 ;Default value 60 second S:'Iterations Iterations=60 ;Default value 60 iterations F loop=1:1:Iterations { S Count=1 S Rset=##class(%Library.ResultSet).%New("%SYS.GlobalQuery:Size") D Rset.Execute(Directory,,"*",1) While Rset.Next() { S Res(Count,"Name")=Rset.Get("Name") S Res(Count,"MB")=Rset.Get("Allocated MB") S Count=Count+1 } K Rset D LOG H Interval } Q LOG ;Logfile O file:"WA" U file W !,$P($ZDT($H,3)," "),tab,$P($ZDT($H,3)," ",2) S SW=0 F X=(Count-1):-1:1 { ;Only record globals with size > minSize I (Res(X,"MB")>minSize) W:SW !,tab W tab,Res(X,"MB"),tab,Res(X,"Name") S SW=1 } C file LOGZ Q ; HEAD ;Logfile header O file:"WA" U file W "DATE",tab,"TIME",tab,"MB",tab,"Global Name" C file HEADZ Q ; ERROR ;errotrap U 0 W !,"Error encountered: ",$ZE,! Q ; ZZ ; 17.01.2012 - 15:58 * Cache-r6.4.9