DATA SEGMENT TOO LARGE

I have encountered a problem which i cannot solve.
After my program compiles but before it is able to
run, it gives me the error message that the data
segment is too large. the maximum stack size has
already been located and i hav tracked down the error
to one section of code in which i use no strings. i
have attached a copy of the code to the bottom. could
you please suggest reasons and/or solutions to this
program? i am using turbo pascal 7

procedure
deleterec(form:char;location,class,toolcol,textcol,hicol:word);
begin
case class of
1:{deleting from regisfile and classfile}
begin
case form of

'1':assign(infofile,'firstclass.dat');

'2':assign(infofile,'secondclass.dat');

'3':assign(infofile,'thirdclass.dat');

'4':assign(infofile,'forthclass.dat');
end;{case}
{$I-}
reset(infofile);
if ioresult <> 0 then
begin
message(13,toolcol,textcol,0);
exit;
end;
{$I+}
assign(tempfile,'temp1.dat');
assign(tempfile2,'temp2.dat');
rewrite(tempfile);
rewrite(tempfile2);
for i := 0 to pred(filesize(regisfile))
do{copying records to temporary file}
begin
if i <> location then{if not record
being deleted the copy record}
begin
seek(regisfile,i);
read(regisfile,details);
seek(tempfile,filesize(tempfile));
write(tempfile,details);
seek(infofile,i);
read(infofile,inforec);

seek(tempfile2,filesize(tempfile2));
write(tempfile2,inforec);
end;{if}
end;{for}
rewrite(regisfile);
rewrite(infofile);
for i := 0 to pred(filesize(tempfile))
do{copying records to permanent file}
begin

seek(tempfile2,filesize(tempfile2));
read(tempfile2,inforec);
seek(infofile,i);
write(infofile,inforec);
seek(tempfile,filesize(tempfile));
read(tempfile,details);
seek(regisfile,i);
write(regisfile,details);
end;{for}
erase(tempfile);{deleting temporary
files}
erase(tempfile2);
close(infofile);
end;

end;{case}




Comments

  • the problem is not nececarily in the procedure
    you have posted. did you see check how much memory
    is required to hold your global variables?

    iby


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories