FastSort Manual

Sorting in Parallel
FastSort Manual429834-003
6-23
Parallel Sorting From TAL Programs
Example 6-3. TAL Example of a Parallel Sort Run (page 1 of 3)
?SYMBOLS, NOCODE, INSPECT, MAP, LMAP, DATAPAGES 64
!-----------------------------------------------------------!
! FastSort Parallel Sort Run !
! This program uses 3 subsorts to sort an input file. !
!-----------------------------------------------------------!
! Global Declarations. !
!-----------------------------------------------------------!
INT .home^term^name[0:11] := 12*[" "]; ! Name
INT home^term^filenum; ! File number
INT .blank^name[0:11] := 12*[" "]; ! Blank file name
!-----------------------------------------------------------!
! Subsort information. !
!-----------------------------------------------------------!
LITERAL max^subsort = 3; ! Maximum number of subsorts
INT .ctlblk[0:199]; ! Control block for sort interface
INT .key^array[0:3]; ! Sort key array definitions
!-----------------------------------------------------------!
! Input and output files. !
!-----------------------------------------------------------!
INT .in^file[0:11] := ["$DISK01 FASTSORTINFILE "];
INT .out^file[0:11] := ["$DISK01 FASTSORTOUTFILE "];
!-----------------------------------------------------------!
! SORTPROG new process information. !
!-----------------------------------------------------------!
STRUCT .newprocess^parms[0:max^subsort];
BEGIN
INT priority; ! Priority
INT memory; ! Memory (ignored by FastSort)
INT cpu; ! CPU number
INT system; ! System
INT segment^size; ! Extended memory
INT swap^file[0:11]; ! Swap file name
INT program^file[0:11]; ! Program file name
END;
INT flags := %B0000001000000000; ! Sort for flags newprocess
!-----------------------------------------------------------!
! Scratch files. !
!-----------------------------------------------------------!
STRUCT .scratch^files[0:max^subsort];
BEGIN
INT filename[0:11]; ! Scratch file name
END;
!-----------------------------------------------------------!
! Sort error and statistics variables. !
!-----------------------------------------------------------!
INT .error^buf[0:31], ! Error message
error^source, ! Error-related information
sub^index, ! Subsort that caused an error
sub^cpu^pin, ! CPU,PIN of this subsort
error, ! Return error code
.stat[0:20]; ! Buffer for statistics
INT(32) error^code; ! FastSort and system error codes
!-----------------------------------------------------------!
?PAGE "External Declarations from EXTDECS0"
!-----------------------------------------------------------!
?NOLIST
?SOURCE $SYSTEM.SYSTEM.EXTDECS0 (DEBUG,
? INITIALIZER,
? MYTERM,
? OPEN,
? READ,
? SORTMERGESTART,
? SORTERRORSUM,
? SORTMERGESTATISTICS,
? SORTMERGEFINISH,
? STOP)