home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / TPDB311.ZIP / SORTDEMO.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1990-02-14  |  692 b   |  25 lines

  1. PROGRAM SortDemo;
  2. {TPDB Version 3.11}
  3. {Copyright 1989 Brian Corll}
  4.  
  5. Uses Crt,TPDB,TPDBSort,TPDBStr;
  6.  
  7.  
  8. {Declare a FAR function which creates the sort key expression.}
  9. {This function MUST call the SortFile object, as shown.}
  10. {$F+}
  11. FUNCTION MakeKey : DBKey;{This function MUST return the type DBKey !}
  12. BEGIN
  13.     MakeKey := Substr(For2Eng(SortFile^.Field(1),ForTable,EngTable),1,1);
  14. END;
  15. {$F-}
  16.  
  17. BEGIN
  18. Writeln('Sorting TEST.DBF to SORT.DBF....');
  19.     {Set the VAR SortFunc equal to the sort key function.}
  20.     SortFunc := MakeKey;
  21.     {Then call the sort with the SortFunc VAR and the input and output files.}
  22.     SortOn(SortFunc,'test.dbf','sort.dbf');
  23. Writeln('Sort complete !');
  24. END.
  25.