Помогите пожалуста доделать програму, а то у меня почему то не работает поиск в моей базе данных при нажатии 2:
'2': begin
clrscr;
search:
writeln;
writeln('n - search for name');
writeln('m - search for model');
writeln('g - search for giver');
writeln('y - search for year');
writeln('c - search for colour');
writeln('p - search for processor');
writeln('r - search for memory');
writeln('e - exit to main menu');
n:=readkey;
case n of
'n':begin
write('Enter name of one of the goods: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if Name=a then
begin
thing;
goto search;
end;{if}
writeln('There is no such thing in data base!');
goto search;
end;{'n':}
'm':begin
write('Enter model of the thing:');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if model=a then
begin
thing;
flag1:=true;
goto next1;
end;{if}
if not flag then writeln('There is no such thing in data base!');
goto search;
next1:
for q:=k+1 to n-1 do
with goods[q] do
if model=a then monitor(q);
goto search;
end;{'m':}
'g':begin
write('Enter giver of one of the goods: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if giver=a then
begin
thing;
goto search;
end;{if}
writeln('There is no such thing in data base!');
goto search;
end;{'g':}
'y':begin
write('Enter year of the car: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if year=a then
begin
thing;flag2:=true;
goto next;
end;{if}
if not flag then writeln('There is no such car in data base!');
goto search;
next:
for q:=k+1 to n-1 do
with goods[q] do
if year=a then monitor(q);
goto search;
end;{'y':}
'c':begin
write('Enter colour of the car: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if colour=a then
begin
thing;
goto search;
end;{if}
writeln('There is no such car in data base!');
goto search;
end;{'c':}
'p':begin
write('Enter type of the processor of the computer: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if processor=a then
begin
thing;
goto search;
end;{if}
writeln('There is no such computer in data base!');
goto search;
end;{'p':}
'r':begin
write('Enter type of the memory of the computer: ');
readln(a);
for k:=1 to n-1 do
with goods[k] do
if memory=a then
begin
thing;
goto search;
end;{if}
writeln('There is no such computer in data base!');
goto search;
end;{'r':}
'e':begin
clrscr;
goto start;
end;{'e':}
else
begin
clrscr;
writeln('You pressed wrong key! Try again.');
goto search;
end;{else:}
end;{case n}
end;{'2':}