home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
C
/
KAFSRT20
/
SORT.DOC
< prev
next >
Wrap
Text File
|
1993-05-29
|
6KB
|
237 lines
SORT - Record Sorting System
SORT IS PART OF THE KAFS SYSTEM
KAFS (INCLUDING SORT) IS SHAREWARE AND MUST BE REGISTERED AFTER
A 30 DAY TRIAL PERIOD.
The Record Sorting System (SORT) is an interface program
designed to sort records that are extracted from data files.
SORT allows the data file(s) to remain in their original form
while sorting by 'tags' associated with each record. SORT works
with fixed length records that are associated with a record
address. SORT has many advantages over other sorting methods
such as reduced sorting times, data integrity, multiple file
data merging and other features.
Using SORT is very easy. Just include the source code module (or
related object file) in your compilation and adhere to the
interface calling conventions described in the SORT Interface
Specs section. A sample program SORTEST.C is included in both
source code and its compiled counterpart SORTEST.EXE. Review the
source code for this sample program and run the program. Doing
that will present the 'C' programmer with a clearer picture than
multitudes of description in written form.
REMEMBER THAT KAFS IS SHAREWARE! YOU ARE ALLOWED TO USE AND
REVIEW THIS SYSTEM FOR 30 DAYS AFTER WHICH TIME YOU ARE REQUIRED
TO REGISTER THIS SOFTWARE.
KAFS, Version 2.0 - REGISTRATION
Copyright 1991 - 1993, Dimestore Software
All rights reserved
You can order or register Dimestore Software products by check
or money order.
TO: FROM:
Dimestore Software Name: _______________________________________
23121 Verdugo Dr. Suite 202
Laguna Hills, CA 92653 (Company):_______________________________________
714-581-6749 Voice (Title):_______________________________________
Address: _______________________________________
Today's
date: ___________ City, State:_______________________________________
Zip Code
Phone Number: _____________________________
KAFS System for MS-DOS
You will receive:
1. A full production Release of the product
2. A Printed Manual
3. All Related Source Code (including KAUTIL)
4. Source Code for DDWIN - Developer's Windows system
Diskette format (choose one) 5.25" disk ____ 3.5" disk ____
Diskette with programs and documentation files $39.95
Shipping & handling 4.95
California residents add 7.75% sales tax ($3.10)
Total enclosed ________
Terms:
Check or Money Order drawn on a USA Bank in US funds. Corporate
Purchase orders (net 30) accepted for software from large
corporations within the USA & Canada. All licenses must be prepaid.
Sort Interface Specs
InitSort(int taglength) - Must be called to initialize the
sort package. An error occurs when there is not enough memory
available. There must be a minimum of 10,240 bytes available
for a sort / merge buffer.
RETURNS: OK or SORTERROR
Sort(char *SortString, long RecordPosition) - Pass the sort tag
and record pointer to the sort module.
RETURNS: OK or SORTERROR
Merge(void) - Merges the sortblocks that were written to disk
(if any).
RETURNS: OK or SORTERROR
Fetch(void) - Returns the next sorted order tag's record (file)
position. When the end of sorted records is reached Fetch()
returns FETCHEND (-1) indicating the end of sorted records.
RETURNS: Records file position (long) or SORTERR or FETCHEND.
The sort 'TAG' is returned in the 'fetchtag' variable.
Endsort(void) - Ends a sort process. Releases memory and
resources.
RETURNS: Nothing
SORT ERROR CODES:
1 InitSort failed - Not enough memory
2 Unable to Open/Create Sort File
3 ERROR Writing to Sort File
4 Unable to Open/Create Merge File
5 Not enough memory for Merge
6 Error reading Sort Tag for Merge
7 Error Writing to Merge File
8 Error Reading Fetch File
9 Sort Tag Length Exceeds Maximum
SORT Technical Notes
A SORT 'TAG' is any string that is comprised of any number of
fields or identifying information about a record or sort element.
All sort tags must be character strings. Numerics must be
converted to strings before calling the sort package. All sorts
are done in ascending order. All returns of SORTERROR are
further qualified by the global variable 'sorterror'. All
sorting should follow the order of INITSORT, SORT, MERGE, FETCH,
ENDSORT.
SORT is very memory efficient. It can function in as little as
10 Kbytes of memory.
Multiple files can be sorted and fetched by adding the file# to
the sort tag and using this during fetch.
When passing the file to generate sort tags select desired
records and only pass these to the sort.
SORT uses 2 temporary sort files if sort space requirements
exceed memory buffers. These temporary files are dynamically
generated and deleted. All temporary files are released by the
ENDSORT function. Temporary files are DOS created 'Temp' files
with a $$$ extension.
The source code is written for the TURBO C compiler, but can be
easily converted to other compilers.
There are 2 global variables of significance to the application:
sorterror - Contains the error code of the last sort error.
fetchtag - contains sort tag of record last fetched.
SORT is network compatible.
** See the SORTEST.C program for examples of SORT usage.