home *** CD-ROM | disk | FTP | other *** search
- Program dbasebrowse;
-
- { Dbasebrowse written by Mark Winkler 5/22/88 - Public Domain }
- { Dirselect was obtained from Borlands DL on CIS and modified to allow
- scrolling of entries when more than 120}
-
- { Downloaded 7/2/88 from a bbs and modified by Mike Shunfenthal CIS 76320,122
- with the following changes:
- 1. file DBASE.PAS renamed DBASEBRO.PAS and
- unit DBF.PAS renamed to DBFINFO.PAS.
- 2. Added option to look for the non-default directory to look for
- a DBF file: either a command line parameter or a prompt
-
- Suggested future enhancements:
- 1. Read index file
- 2. Read memo file
- 3. Convert stored, encoded date type into standard type: MM/DD/YYYY
- }
-
- uses
- crt,dos,dbfinfo,dirsel;
-
-
- { open DBase file }
- { dberr = ioresult }
-
- procedure dbopen(filename : string);
- begin
- dbfilename := filename;
- assign(dbfile,filename);
- {$I-}
- reset(dbfile,1);
- {$I+}
- dberr := ioresult;
- dbfileok := (dberr=0);
- end; { dbopen }
-
- procedure getfile;
-
- var filemask : string [64];
-
- procedure readcmdline;
- begin
- if ParamCount = 0 then
- begin
- Write( 'Enter directory or <Return>: ');
- gotoxy(26,14);
- Readln( filemask)
- end
- else
- filemask := ParamStr(1);
- if (filemask <> '') and (copy (filemask, length( filemask), 1) <> '\')
- then filemask := filemask + '\'
- end {readcmdline};
-
- begin
- readcmdline;
- dbfilename := dirselect( filemask + '*.dbf', directory);
- if dbfilename = '' then
- begin
- dbfileok := false;
- exit;
- end;
- dbopen( filemask + dbfilename);
- if not dbfileok then
- begin
- writeln ('Unable to open ', dbfilename);
- exit
- end;
- dbhdrd;
- if not dbfileok then
- begin
- if dberr < 256 then
- begin
- writeln;
- writeln('Error - Short Blockread on Header ',dberr,chr(7));
- exit;
- end else
- begin
- writeln;
- writeln('Error - Not DBASE III file ',dberr,chr(7));
- exit;
- end;
- end;
-
- end; { getfile }
-
- procedure browse;
- var
- choice : char;
-
- begin
- currentrec := 0;
- repeat
- clrscr;
- gotoxy(30,1);
- write('DBASE III File Browser');
- gotoxy(34,8);
- write('Menu Options');
- gotoxy(26,10);
- write('H = Display Header Information');
- gotoxy(26,11);
- write('R = Display Record');
- gotoxy(26,12);
- write('X = Exit to Main Menu');
- gotoxy(26,14);
- write('Enter Choice ');
- choice := readkey;
- case choice of
- 'H','h' : dbwrthd;
- 'R','r' : disprec;
- 'X','x' : exit;
- else
- write(chr(7));
- end;
- if keypressed then choice := readkey;
- until false;
- end; { browse }
-
-
- var
- choice : char;
-
- begin
- repeat
- clrscr;
- gotoxy(25,1);
- write('DBASE III File Browser Ver 1.0');
- gotoxy(34,8);
- write('Menu Options');
- gotoxy(26,10);
- write('D = Display Files');
- gotoxy(26,11);
- write('X = Exit Program');
- gotoxy(26,13);
- write('Enter Choice ');
- choice := readkey;
- case choice of
- 'D','d' : begin
- getfile;
- if dbfileok then browse;
- end;
- 'X','x' : exit;
- else
- write(chr(7));
- end;
- if keypressed then choice := readkey;
- until false;
- end. { dbasebrowse }