sathish1910
03-16-2009, 07:14 AM
hi ,
i have tryied to read the large size log file (175mb ) but i need to read it by split
this is the code i have geting more run space and more memory usage . how can i reduce the memory usage size and run time space
this is the code i 'm using
<html>
<body>
<%
fname=Request.QueryString("fname")
time2=Request.QueryString("time2")
%>
<form action="write.asp" method="get">
From Time: <input type="text" name="fname" size="20" value="<%=fname%>"/>
To Time: <input type="text" name="time2" size="20" value="<%=time2%>"/>
<input type="submit" value="Submit" />
</form>
<%
server.ScriptTimeout=600
dim fname,time2
If fname<>"" Then
const ForReading = 1
const TristateFalse = 0
dim strSearchThis
dim objFS
dim objFile
dim objTS
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFile = objFS.GetFile(Server.MapPath("PriceData@01_30_2009.log"))
'set objFile = objFS.GetFile(Server.MapPath("s.log"))
set objTS = objFile.OpenAsTextStream(ForReading, TristateFalse)
temp=""
do while objTS.AtEndOfStream<>true
strSearchThis = objTS.Read(1024*12000)
if temp<>"" then
SpaceLoc2 = InStr(strSearchThis, time2)
if SpaceLoc2=0 then
temp=temp&mid(strSearchThis,1,len(strSearchThis))
else
temp=temp&mid(strSearchThis,1,SpaceLoc2)
response.write(temp)
set objFS=nothing
set objFile=nothing
set objTS=nothing
response.end
end if
else
SpaceLoc1 = InStr(strSearchThis, fname)
SpaceLoc2 = InStr(strSearchThis, time2)
if SpaceLoc1 > 0 and SpaceLoc2 > 0 then
temp=mid(strSearchThis,SpaceLoc1,SpaceLoc2-SpaceLoc1)
response.write(temp)
set objFS=nothing
set objFile=nothing
set objTS=nothing
response.end
else
if SpaceLoc1 > 0 and SpaceLoc2=0 then
temp=mid(strSearchThis,SpaceLoc1,len(strSearchThis))
response.write(temp)
else
'nothing
end if
end if
end if
loop
end if
set objFS=nothing
set objFile=nothing
set objTS=nothing
%>
</body>
</html>
i have tryied to read the large size log file (175mb ) but i need to read it by split
this is the code i have geting more run space and more memory usage . how can i reduce the memory usage size and run time space
this is the code i 'm using
<html>
<body>
<%
fname=Request.QueryString("fname")
time2=Request.QueryString("time2")
%>
<form action="write.asp" method="get">
From Time: <input type="text" name="fname" size="20" value="<%=fname%>"/>
To Time: <input type="text" name="time2" size="20" value="<%=time2%>"/>
<input type="submit" value="Submit" />
</form>
<%
server.ScriptTimeout=600
dim fname,time2
If fname<>"" Then
const ForReading = 1
const TristateFalse = 0
dim strSearchThis
dim objFS
dim objFile
dim objTS
set objFS = Server.CreateObject("Scripting.FileSystemObject")
set objFile = objFS.GetFile(Server.MapPath("PriceData@01_30_2009.log"))
'set objFile = objFS.GetFile(Server.MapPath("s.log"))
set objTS = objFile.OpenAsTextStream(ForReading, TristateFalse)
temp=""
do while objTS.AtEndOfStream<>true
strSearchThis = objTS.Read(1024*12000)
if temp<>"" then
SpaceLoc2 = InStr(strSearchThis, time2)
if SpaceLoc2=0 then
temp=temp&mid(strSearchThis,1,len(strSearchThis))
else
temp=temp&mid(strSearchThis,1,SpaceLoc2)
response.write(temp)
set objFS=nothing
set objFile=nothing
set objTS=nothing
response.end
end if
else
SpaceLoc1 = InStr(strSearchThis, fname)
SpaceLoc2 = InStr(strSearchThis, time2)
if SpaceLoc1 > 0 and SpaceLoc2 > 0 then
temp=mid(strSearchThis,SpaceLoc1,SpaceLoc2-SpaceLoc1)
response.write(temp)
set objFS=nothing
set objFile=nothing
set objTS=nothing
response.end
else
if SpaceLoc1 > 0 and SpaceLoc2=0 then
temp=mid(strSearchThis,SpaceLoc1,len(strSearchThis))
response.write(temp)
else
'nothing
end if
end if
end if
loop
end if
set objFS=nothing
set objFile=nothing
set objTS=nothing
%>
</body>
</html>