FastSort Manual

Sorting in Parallel
FastSort Manual429834-003
6-16
Parallel Sorting From C Programs
struct newprocess_parms_template { /* 29-word structure */
short priority;
short memory;
short cpu;
short system;
short segment_size;
char swap_file[24];
char program_file[24];
} _lowmem newprocess_parms[MAXSUBSORTS + 1];
/*-------------------------------------------------------------*/
/* Input and output files */
/*-------------------------------------------------------------*/
_lowmem char infile[] = "$DATA2 FSORT256INFILE";
_lowmem char outfile[] = "$DATA2 FSORT256OUTFIL";
struct scratch_files_template {
char filename[24];
} _lowmem scratch_files[MAXSUBSORTS + 1];
struct scratch_pool_template {
short reserved_word1;
short reserved_word2;
short reserved_word3;
short reserved_word4;
short reserved_word5;
short reserved_word6;
short reserved_word7;
short reserved_word8;short use_scratch;
short num_scratch_vols;
short scratchvolnames[MAXSCRATCHVOLS];
} _lowmem scratch_pool;
void error_handler (void);
short DisplaySortStatistics (struct sortstats_template *);
/*-------------------------------------------------------------*/
#pragma page " Main logic "
/*-------------------------------------------------------------*/
int main (void)
{
short errlen = 0;
short i,j;
/* Initialize temp scratch volume name and I/O filename arrays.*/
/* Leave blank for distributor-collector sort. */
char tmp_dist_scr = " ";
char tmp_scr1[] = "$DATA1 ";
char tmp_scr2[] = "$DATA2 ";
char tmp_scr3[] = "$DATA4 ";
char tmp_swap[] = " ";
char tmp_prog[] = " ";
char tmp_infile[] = "$DATA2 FSORT256INFILE ";
char tmp_outfile[] = "$DATA2 FSORT256OUTFIL ";
/*initialize scratch pool array;will be passed to all subsorts */
char tmp_scr_pool[] = "$DATA1 $DATA2 $DATA3 $DATA4 ";
_lowmem short actuallen; /* size of statistics in words */
/*-------------------------------------------------------------*/
/* Perform standard initialization. */
/*-------------------------------------------------------------*/
error = PROCESS_GETINFO_(,,,,,,(char *)&home_term_name,
home_term_maxlen,
&home_term_len,
,,,,,,,,,,,&error_detail);
if (error)
DEBUG;
if (FILE_OPEN_(home_term_name,
home_term_len,
&home_term_filenum) != CCE )
DEBUG;
INITIALIZER; /* read the startup message */
Example 6-1. C Example of a Parallel Sort Run (page 2 of 5)