home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
insidetp
/
1990_07
/
printdbf.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1990-06-28
|
2KB
|
74 lines
{================================================
= PROGRAM: PRINTDBF.PAS =
= PURPOSE: Print listings of Dbase III+/IV =
= DBF files =
================================================}
{------------------------------------------------
Initialize variables and create types -
-----------------------------------------------}
USES Crt, dBASE;
VAR
DFile : DbfFile;
ActionHdr : Byte;
ActionFile : Boolean;
PROCEDURE Beep;
BEGIN
Sound(1000);Delay(500);NoSound
END;
{------------------------------------------------
- Main processing loop -
-----------------------------------------------}
BEGIN
ClrScr;
DFile := DbfOpen('PLANETS.DBF');
WriteLn;
ActionHdr := DbfReadHdr(DFile);
CASE ActionHdr OF
1 : BEGIN
Beep;
WriteLn('Not a dBASE III+ or IV file.')
END;
3 : BEGIN
Beep;
WriteLn('Error reading dBASE file.')
END
ELSE
BEGIN
DbfDispHdr(DFile);
Pause;
ActionFile := DbfReadStru(DFile);
CASE ActionFile OF
TRUE :
BEGIN
ClrScr;
DbfDispStru(DFile);
Pause;
IF ActionHdr <> 2 THEN
BEGIN
ClrScr;
DbfList(DFile);
Pause
END
ELSE
BEGIN
ClrScr;
WriteLn('No records to print')
END
END;
FALSE :
BEGIN
Beep;
WriteLn('Field information error')
END
END {Case ActionFile}
END; {Case ActionHdr}
ActionFile := DbfClose(DFile);
END
END.