DataLoader/MX Reference Manual (H06.03+, J06.03+)

Creating a Customized Version of DataLoader/MX
DataLoader/MX Reference Manual543544-001
5-35
Sorting With DTLSort
Specify a Col and Len pair for each column in the result. DataLoader/MX moves a
maximum of Lenn bytes to its corresponding Coln column.
For a field with n columns added through DTLCartAddCol, use
DTLCARTGENERATEnCOLFIELDCOB.
Sorting With DTLSort
This procedure provides a very simple interface for sorting.
The syntax is:
Initially DTLSort is in the unintialized state. On the first call, Buf must point to a
null-terminated string describing the key fields, and Len must point to the length of the
longest record that will be sorted.
Upon return from this initialization call, DTLSort is ready to take the records to be
sorted. It is called once for each input record where Buf points to the record, and Len
points to the length of that record.
When all input records have been given to DTLSort, it is called once more with Len
pointing to a -1 to indicate that all records have been input. The contents of Buf are
irrelevant on this call.
Upon return from this end of input call, DTLSort is ready to return the records in sorted
order. Each call to DTLSort returns the next record in the memory pointed to by Buf,
and the int pointed to by Len is set to the length of the record.
After all records have been returned, the next call causes DTLSort to set the int
pointed to by Len to -1, indicating that all sorted records have been returned. This call
also sets the memory pointed to by Buf to information about the sort. This information
is in a 44-byte structure so, for this reason, the memory pointed to by Buf when
retrieving sorted records should be at least 44 bytes long.
Upon return from this end of output call, DTLSort is again in the uninitialized state, and
the whole sequence can be repeated if another sort is to be done.
If errors occur, DTLSort generates an appropriate error message and terminates.
DTLSort uses FastSort to do the sorting, so you can control how DTLSort works by
using the FastSort DEFINEs described in the FastSort Manual. Use DEFINEs when
sorting large amounts of data and to request parallel sorting.
void DTLSort( char* Buf, int* Len );