3 ms·
There were many languages which had support for records. Here is an example in Turbo Pascal: program PBook; type EntryRec = record Name:
by badsectoracula 7y ago
There were many languages which had support for records. Here is an example in Turbo Pascal:
program PBook;
type
EntryRec = record
Name: string[32];
Phone: string[30];
end;
var
Entries: File of EntryRec;
Entry: EntryRec;
C: Char;
I: Longint;
begin
Assign(Entries, 'entries.dat');Reset(Entries);
repeat
Write('Phone book, what to do? (Enter, List, Modify, Quit) ');
Readln(C); C:=UpCase(C);
if C='E' then begin
Write('Name: '); Readln(Entry.Name);
Write('Phone: '); Readln(Entry.Phone);
Seek(Entries, FileSize(Entries));
Write(Entries, Entry);
end else if C='L' then begin
Seek(Entries, 0);
while not Eof(Entries) do begin
Read(Entries, Entry);
Writeln('Name:', Entry.Name:32, ' Phone:', Entry.Phone:30);
end;
end else if C='M' then begin
Write('Entry number (0..', FileSize(Entries) - 1,'): ');Readln(I);
Seek(Entries, I);
Read(Entries, Entry);
Write('Name (', Entry.Name, '): ');Readln(Entry.Name);
Write('Phone (', Entry.Phone, '): ');Readln(Entry.Phone);
Seek(Entries, i);
Write(Entries, Entry);
end;
until C='Q';
Close(Entries);
end.
Many BASIC dialects, like GW-Basic, also had support for record-based files. Though since they often didn't have explicit type support these records were defined in terms of how many fields and characters per field would fit in a record, but still you worked with what was essentially a flat-file database.
And of course there were the more high level "4GL" languages that combined a full database and a (mostly) general purpose programming language, like dBase/FoxPro/etc. These also had features like a visual form editor that allowed building data entry and manipulation applications quickly.