Ajesh
1st June 2013, 12:21
Hello

I tried to search the Core Files Topic but didn't find the relevant one so i am opening a new Topic here.


My Session tries to process a large number of records. Apparently the number of records is 9 lakhs.

And i have tried to process the records in the batch of 50k Records. But as soon i am through with around 3 4 Lakh Records i get a Message of "Running out of Memory" and then it exits and i get a Core File.



Header = true
Last.Batch = False
cins.inter.f = cins.f

While Last.Batch = false

count = 0
file.initiation()
select tssma102.*
from tssma102 for update
where tssma102._index1 inrange {:cins.inter.f}
and {:cins.t}
and tssma102.orno <> 0
order by tssma102._index1
selectdo
select tdsls041.orno
from tdsls041
where tdsls041._index1 = {:tssma102.orno,:tssma102.pono}
Selectdo
count = count + 1
if Header = true then
update.desc = enum.descr$("tcyesno",form.update)
Curr.date = sprintf$("%D(Date: %02d/%02m/%04Y)",
date.num())
file.input = "Update = " & update.desc & ", " &
strip$(Curr.date) & " " & Current.time & ", " &" User: "& logname$
seq.puts(file.input, file.pointer)
file.input = ""
file.input(1;20) = "Installation"
file.input(21;1) = ";"
file.input(22;9) = "SO Number"
file.input(31;1) = ";"
file.input(32;10) = "SO Line No"
seq.puts(file.input, file.pointer)
Header = false
endif

file.input(1;20) = str$(strip$(shiftl$(tssma102.cins)))
file.input(21;1) = ";"
file.input(22;9) = str$(tssma102.orno)
file.input(31;1) = ";"
file.input(32;10) = str$(tssma102.pono)

ret.val = seq.puts(file.input, file.pointer)

if form.update = tcyesno.yes then
tssma102.owno.c = str$(tssma102.orno) & "-" & str
$(tssma102.pono)
tssma102.orno = 0
tssma102.pono = 0
db.update(ttssma102,db.retry)
endif
if count = 100000 then
select d102.cins:cins.inter.f
from tssma102 d102
where d102._index1 > {:tssma102.cins}
as set with 1 rows
selectdo
endselect
break
endif
endselect
if count = 100000 then
break
endif
selecteos
Last.Batch = true
endselect
if form.update = tcyesno.yes and count <> 0 then
commit.transaction()
ret.val = seq.close(file.pointer)
else
if count <> 0 then
ret.val = seq.close(file.pointer)
endif
endif

ENDWHILE






For some reason i think the Clue to this would be the session releasing the records from its buffer to Update.


Any Clues Anyone?

Regards
Ajesh

mark_h
1st June 2013, 18:27
Are you sure each file is getting open and closed correctly? That was the first thing that popped into my mind.

vahdani
2nd June 2013, 10:51
Hi,

this might be caused by the size of the database transaction undo buffer. You commit your transaction after 100000 records! This is a lot. You should reduce this number. A number around 50 to 100 is usually recommended.

I would add something like the red section below:

if count = 100000 then
break
endif
if count\50 = 0 then
if form.update = tcyesno.yes then
commit.transaction()
else
abort.transaction()
endif
endif
selecteos
Last.Batch = true
endselect
if form.update = tcyesno.yes and count <> 0 then
commit.transaction()
ret.val = seq.close(file.pointer)
else
if count <> 0 then
ret.val = seq.close(file.pointer)
endif
endif

Ajesh
2nd June 2013, 13:20
Are you sure each file is getting open and closed correctly? That was the first thing that popped into my mind.


Yes The Files are getting opened and Closed Correctly.


Hi,

this might be caused by the size of the database transaction undo buffer. You commit your transaction after 100000 records! This is a lot. You should reduce this number. A number around 50 to 100 is usually recommended.

I would add something like the red section below:

if count = 100000 then
break
endif
if count\50 = 0 then
if form.update = tcyesno.yes then
commit.transaction()
else
abort.transaction()
endif
endif
selecteos
Last.Batch = true
endselect
if form.update = tcyesno.yes and count <> 0 then
commit.transaction()
ret.val = seq.close(file.pointer)
else
if count <> 0 then
ret.val = seq.close(file.pointer)
endif
endif


Actually i introduced commit.transaction in one of the areas of the code and it ran successfully.


if form.update = tcyesno.yes and count <> 0 then
commit.transaction()
ret.val = seq.close(file.pointer)
else
if count <> 0 then
ret.val = seq.close(file.pointer)
commit.transaction()
endif
endif



Also does it have to do with today being a Saturday and not many transactions are being run?

I need to try it on a Weekday as i feel that might be a true test.