Dataloader/MP Reference Manual

Table Of Contents
Creating a Customized Version of DataLoader/MP
DataLoader/MP Reference Manual424148-003
5-34
Sorting With DTLSort
Field
is a value from 1 through 10 that specifies the field to which the column is to be
added.
Coln
is the variable that holds the result.
Lenn
is the maximum number of characters that may be placed in Coln.
Specify a Col and Len pair for each column in the result. DataLoader/MP 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
DTLSort provides a very simple interface for sorting.
The syntax for this procedure follows:
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 the records have been input. The contents of Buf is
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 the sorted records have been returned. This
short DTLCARTGENERATE5COLFIELDCOB ( short field,
char* Col1, short Len1,
char* Col2, short Len2,
char* Col3, short Len3,
char* Col4, short Len4,
char* Col5, short Len5);
void DTLSort( char* Buf, int* Len );