sort_comp: proc; /* sort's standard comparison routine */ dcl b_str bit(32000) based, /* used for bit string data type */ fb1(0:32000) fixed bin(35) based, /* used for bin, aligned, size = 36 bits-1 word */ fb2(0:32000) fixed bin(71) based, /* used for bin, aligned, size = 72 bits-2 words */ (work_1,work_2) fixed bin(71),/* used for bin unaligned */ flb1(0:32000) float bin(27) based, /* used for float bin, aligned, size = 36 bits-1 word */ flb2(0:32000) float bin(63) based, /* used for float bin, aligned, size = 72 bits-2 words */ (work_3,work_4) float bin(63) aligned, /* used for float bin,unaligned */ (work_5,work_6) dec(59), /* used for decimal */ (work_7,work_8) float dec(59); /* floating decimal-taking 61 bytes */ dcl dec_char char(61) based aligned, dec_ptr1 ptr, dec_ptr2 ptr; dcl dec_ptr3 ptr, dec_ptr4 ptr; if compare_sw ^= 0 then do; /* invoke user's compare routine */ result = sort_ext$sort_compare_exit(pt1,pt2); if result ^= 0 then go to con; end; else do; do i1 = 0 to no_of_keys; go to lab(dt(i1)); lab(1): /* data type = char */ if substr(pt1->S,b(i1),leng(i1))< substr(pt2->S,b(i1),leng(i1)) then result = -1; /* record 1 ranks first */ else if substr(pt1->S,b(i1),leng(i1))> substr(pt2->S,b(i1),leng(i1)) then result = 1; else go to next_key; go to esc; lab(2): /* data type = bit */ if substr(pt1->b_str,b(i1),leng(i1)) < substr(pt2->b_str,b(i1),leng(i1)) then result = -1; else if substr(pt1->b_str,b(i1),leng(i1)) > substr(pt2->b_str,b(i1),leng(i1)) then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(3): /* data type = binary-aligned-size= 1 word */ if pt1->fb1(w(i1)) < pt2->fb1(w(i1)) then result = -1; /* record 1 ranks first */ else if pt1->fb1(w(i1))> pt2->fb1(w(i1)) then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(4): /* data type = binary-aligned-size = 2 words */ if pt1->fb2(w(i1)) < pt2->fb2(w(i1)) then result = -1; /* record 1 ranks first */ else if pt1->fb2(w(i1)) > pt2->fb2(w(i1)) then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(5): /* data type = binary-unaligned: 1<= len <= 71 */ work_1 = 0; work_2 = 0; /* 0 out work areas */ substr(unspec(work_1),1,leng(i1)+1)=substr(pt1->b_str,b(i1),leng(i1)+1); /* move unaligned bit string into aligned work field */ substr(unspec(work_2),1,leng(i1)+1)=substr(pt2->b_str,b(i1),leng(i1)+1); if work_1 < work_2 then result = -1; /* record 1 ranks first */ else if work_1 > work_2 then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(6): /* data type = floating bin-aligned,size = 1 word */ if pt1->flb1(w(i1)) < pt2->flb1(w(i1)) then result = -1; /* record 1 ranks first */ else if pt1->flb1(w(i1)) > pt2->flb1(w(i1)) then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(7): /* data type = floating bin - aligned, size = 2 words */ if pt1->flb2(w(i1)) < pt2->flb2(w(i1)) then result = -1; /* record 1 ranks first */ else if pt1->flb2(w(i1)) > pt2->flb2(w(i1)) then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(8): /* data type = floating bin-unaligned */ work_3 = 0; work_4 = 0; /* 0 out work areas */ substr(unspec(work_3),1,leng(i1)+9)=substr(pt1->b_str,b(i1),leng(i1)+9); substr(unspec(work_4),1,leng(i1)+9)=substr(pt2->b_str,b(i1),leng(i1)+9); /* move unaligned bit string into aligned work field */ if work_3 < work_4 then result = -1; /* recordnks first */ else if work_3 > work_4 then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(9): /* data type = decimal */ work_5 = 0; dec_ptr3 = addr(work_5); work_6 = 0; /* 0 out work areas */ dec_ptr4 = addr(work_6); substr(dec_ptr3->dec_char,1,leng(i1)+1)=substr(pt1->S,b(i1),leng(i1)+1); substr(dec_ptr4->dec_char,1,leng(i1)+1)=substr(pt2->S,b(i1),leng(i1)+1); /* move decimal field into work field */ if work_5 < work_6 then result = -1; /* record 1 ranks first */ else if work_5 > work_6 then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; lab(10): /* data type = floating decimal */ work_7 = 0; dec_ptr1 = addr(work_7); work_8 = 0; /* 0 out work areas */ dec_ptr2 = addr(work_8); substr(dec_ptr1->dec_char,1,leng(i1)+1)=substr(pt1->S,b(i1),leng(i1)+1); substr(dec_ptr2->dec_char,1,leng(i1)+1)=substr(pt2->S,b(i1),leng(i1)+1); /* move sign and digits into work areas */ substr(dec_ptr1->dec_char,61,1)=substr(pt1->S,leng(i1)+1+b(i1),1); substr(dec_ptr2->dec_char,61,1)=substr(pt2->S,leng(i1)+1+b(i1),1); /* move exponent portion into work field */ if work_7 < work_8 then result = -1; /* record 1 ranks first */ else if work_7 > work_8 then result = 1; /* record 2 ranks first */ else go to next_key; go to esc; next_key: end; /* ends do loop */ result = 0; /* all keys equal */ return; esc: if rev(i1) ^= 0 then result = -result; /* reverse ranking */ con: end; /* ends sort's comparison routine */ end sort_comp; */ ----------------------------------------------------------- Historical Background This edition of the Multics software materials and documentation is provided and donated to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. as a contribution to computer science knowledge. This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology, Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull and Bull HN Information Systems Inc. to the development of this operating system. Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970), renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for managing computer hardware properly and for executing programs. Many subsequent operating systems incorporated Multics principles. Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. . ----------------------------------------------------------- Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without fee is hereby granted,provided that the below copyright notice and historical background appear in all copies and that both the copyright notice and historical background and this permission notice appear in supporting documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining to distribution of the programs without specific prior written permission. Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc. Copyright 2006 by Bull HN Information Systems Inc. Copyright 2006 by Bull SAS All Rights Reserved */