FastSort Manual

Sorting Programmatically
FastSort Manual429834-003
4-12
Sorting From C Programs
if (error) /* check for SORTMERGESEND error */
{
errlen = SORTERRORSUM (&ctlblk[0],
&error_buf[0],
&error_code[0],
&error_source[0]);
error_handler ;
return EXIT_FAILURE;
}
/*------------------------------------------------------------*/
/* Call SORTMERGERECEIVE to receive records from SORTPROG. */
/*------------------------------------------------------------*/
do
{
error = SORTMERGERECEIVE (&ctlblk[0],
,
&length
,
,
,(long) &inbuf[0] );
if (error) /* check for SORTMERGERECEIVE error */
{
errlen = SORTERRORSUM (&ctlblk[0],
&error_buf[0],
&error_code[0],
&error_source[0]);
error_handler;
return EXIT_FAILURE;
}
/*-------------------------------------------------------------*/
/* Output the values one at a time to the terminal */
/*-------------------------------------------------------------*/
NUMOUT (&outbuf[0],inbuf[0],10,2);
WRITE (home_term_filenum, (short *) &outbuf[0],length);
}
while (length != -1);
/*-------------------------------------------------------------*/
/* Return SORTPROG completion errlen and statistics. Set */
/* length in words, to return all statistics information. */
/*-------------------------------------------------------------*/
actuallen = sizeof(sortstats)/2;
error = SORTMERGESTATISTICS (&ctlblk[0], &actuallen, &sortstats,
sflag1);
if (error) /* check for SORTMERGESTATISTICS error */
{
errlen = SORTERRORSUM (&ctlblk[0],
&error_buf[0],
&error_code[0],
&error_source[0]);
error_handler;
return EXIT_FAILURE;
}
*-------------------------------------------------------------*/
/* Call function to display the statistics */
/*-------------------------------------------------------------*/
error = DisplaySortStatistics (&sortstats);
if (error)
return EXIT_FAILURE;
Example 4-1. C Example of a Serial Sort Run (page4of5)