home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
NEWS
/
552
/
GSDMO_19.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-10-07
|
2KB
|
70 lines
program GSDMO_19;
{------------------------------------------------------------------------------
DBase File Sorting
Copyright (c) Richard F. Griffin
06 February 1993
102 Molded Stone Pl
Warner Robins, GA 31088
-------------------------------------------------------------
This program demonstrates how dBase files may be sorted using
Griffin Solutions units.
The program creates (if necessary) and opens a dBase file and its
memo. It then sorts the file to GSDMO19S.DBF and GSDMO19S.DBT.
The sort fields are LASTNAME and FIRSTNAME.
Records will only be sorted if they are valid (i.e., deleted records
are ignored if SetDeletedOn, and SetFilterThru must validate the
record as well).
New procedures/functions introduced are:
SortTo
-------------------------------------------------------------------------------}
uses
GSOB_Var,
GSOB_Gen,
GSOBShel,
{$IFDEF WINDOWS}
WinCRT;
{$ELSE}
CRT;
{$ENDIF}
var
fx : file;
begin
ClrScr;
if not FileExist('GSDMO_19.DBF') then
begin
writeln('Creating GSDMO_19.DBF');
MakeTestData(3,'GSDMO_19', 20, true); {Make a dBase III file w/memo}
writeln('GSDMO_19.DBF Created');
end;
Select(1);
Use('GSDMO_19');
Writeln('Sorting to file GSDMO19S.DBF..');
SortTo('GSDMO19S','LASTNAME+FIRSTNAME',SortUp);
Writeln('Listing from Sorted file GSDMO19S.DBF..');
Select(2); {Use record area 2 for new file}
Use('GSDMO19S'); {Assign the sorted dBase III file GSDMO19S}
GoTop;
while not dEOF do
begin
writeln(FieldGet('LASTNAME'),' ',
FieldGet('FIRSTNAME'),' ',
RecNo);
Skip(1);
end;
CloseDataBases;
end.