home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG027.ARC
/
TTUPDATE.INC
< prev
next >
Wrap
Text File
|
1979-12-31
|
5KB
|
172 lines
PROCEDURE find;
LABEL
escape;
VAR
k,l : INTEGER;
dummy : str20;
tc : CHAR;
ok2 : integer;
BEGIN
line(1);
dis(1,2,' F I N D M E N U ');
DisDate;
Display_Recs_Used;
line(16);
dis(1,17,' Type in Ear Number | ^Z = ABORT |');
ClrEOL;
dummy := '';
inputstr(dummy,5,22,3,[^M,^Z],TC);
IF tc = ^Z
THEN GOTO escape;
IF dummy <> ''
THEN
BEGIN
dummy := UpcaseStr(dummy);
fillup(dummy);
FindKey(EarIndexFile,Ptr,Dummy);
if ok then
begin
GetRec(DatF,Ptr,Animal);
end;
END
ELSE
BEGIN
dis(1,17,' Type in Full Name | ^Z = ABORT |');
ClrEOL;
dummy := '';
inputstr(dummy,20,46,3,[^M,^Z],TC);
IF tc = ^Z
THEN GOTO escape;
IF dummy <> '' THEN
BEGIN
SearchKey(NameIndexFile,Ptr,Dummy);
if not ok then
PrevKey(NameIndexFile,Ptr,Dummy);
repeat
GetRec(DatF,Ptr,Animal);
DisplayForm;
Display_Animal(Animal);
dis(1,17,' | | | | | | N = Next | P = Previous | <ESC> = UPDATE MENU |');
select(74,17,' ',['N','P',#27],ch);
case ch of
'N' : repeat NextKey(NameIndexFile,Ptr,Dummy) until ok;
'P' : repeat PrevKey(NameIndexFile,Ptr,Dummy) until ok;
end; {case}
until ch = #27;
END;
END;
line(1);
dis(1,2,' E D I T M E N U ');
DisDate;
display_Animal(Animal);
line(16);
dis(1,17,' | | | | | | E = Edit | D = Delete | <ESC> = UPDATE MENU |');
f_table;
LowVideo;
dis(1,15,'P/table No, E, D or <ESC>');
NormVideo;
repeat
k := 0;
select(74,17,' ',['1','2','3','4','5','6','E','D',#27],ch);
val(ch,k,ok2);
IF k IN [1..6] THEN Animals_table(k,Animal);
until (ch = #27) or (ch = 'E') or (ch = 'D');
dis(1,15,' ');
CASE ch OF
'E' : BEGIN
edit(Animal);
END;
'D' : BEGIN
with Animal do
begin
DeleteKey(EarIndexFile,Ptr,Ear_No);
DeleteKey(NameIndexFile,Ptr,Name);
DeleteRec(DatF,Ptr);
end;
END;
ELSE ch := ^M;
END;{case fo ch}
escape:
END;
PROCEDURE Add;
(* Add is used to add a Animal *)
var
ear : str5;
k,ok2 : integer;
DataF : integer;
BEGIN
dis(1,17,' | | | | | | | ^Z = ABORT | <ESC> = FINISHED |');
ClrEOL;
F_TABLE;
ear := '';
Initialize(Animal);
FillChar(Animal,SizeOf(Animal),0);
repeat
InputAnimal(Animal,CH);
FindKey(EarIndexFile,DataF,Animal.Ear_No);
if ok then
begin
GotoXY(10,9);
LowVideo;
Write(' D U P L I C A T E Ear number ');
NormVideo;
end;
until not ok;
IF ch = #27 THEN
BEGIN
Animal.Rec_No := UsedRecs(DatF) + 1;
AddRec(DatF,DataF,Animal);
AddKey(EarIndexFile,DataF,Animal.Ear_No);
AddKey(NameIndexFile,DataF,Animal.Name);
ch := ' ';
END;
repeat
LowVideo;
dis(1,15,'P/table No or <ESC>');
NormVideo;
k := 0;
select(74,17,' ',['1','2','3','4','5','6','E','D',#27],ch);
val(ch,k,ok2);
IF k IN [1..6] THEN Animals_table(k,Animal);
f_table;
until (ch = #27) or (k in [1..6]);
ch := ^M;
END;
BEGIN(* Update*)
line(1);
dis(1,2,' U P D A T E M E N U ');
disdate;
REPEAT
gotoxy(1,2);
Display_Recs_Used;
DisplayForm;
k := 0;
line(16);
dis(1,17,' | | | | | | A = Add | F = Find | <ESC> = MAIN MENU |');
f_table;
select(74,17,' ',['1','2','3','4','5','6','A','F',#27],Ch);
val(ch,k,ok2);
IF k IN [1..6]
THEN BEGIN
IF Animal_table[k].rec_no <> -1
THEN BEGIN
FindKey(EarIndexFile,Ptr,Animal_Table[k].Ear_No);
GetRec(DatF,Ptr,Animal);
display_Animal(Animal);
edit(Animal);
END;
END
ELSE
CASE Ch OF
'A' : Add;
'F' : Find;
END;
Update_Animal_Table(Animal);
UNTIL Ch = #27;
clrscr;
END;