COMPILATION LISTING OF SEGMENT sort_initiate Compiled by: Multics PL/I Compiler, Release 28d, of October 4, 1983 Compiled at: Honeywell Multics Op. - System M Compiled on: 02/14/84 0736.1 mst Tue Options: optimize map 1 /* *********************************************************** 2* * * 3* * Copyright, (C) Honeywell Information Systems Inc., 1982 * 4* * * 5* *********************************************************** */ 6 7 /* *************************************** 8* * * 9* * * 10* * Copyright (c) 1975, 1976 by * 11* * Honeywell Information Systems, Inc. * 12* * * 13* * * 14* *************************************** */ 15 /* ENTRY external to the Sort. 16* Used by procedures which drive the Sort themselves. */ 17 18 /* Coded in ancient times by who knows */ 19 /* Modified 4 Nov 1983 by C Spitzer. phx9857: work files bigger than 255 pages if input file is big enough 20* phx9927: make segs multiples of 64 pages to prevent ASTE thrashing */ 21 22 initiate: proc(temp_dir, keys_ptr, exits_ptr, user_out_sw_par, file_size_par, code); 23 24 /* PARAMETERS */ 25 dcl (temp_dir char(*), /* Directory to contain work files: 26* "" = process directory; 27* relative or absolute path name. */ 28 keys_ptr ptr, /* Pointer to keys substructure */ 29 exits_ptr ptr, /* Pointer to exits substructure */ 30 user_out_sw_par char(*), /* Destination of Sort Report: 31* "" = normal (user_output); 32* "-bf" = none (discard); 33* "" = switchname. */ 34 file_size_par float bin(27), /* File size passed by caller (sort, sort_, or user) - 35* millions of bytes (Input). */ 36 code fixed bin(35) /* Status code */ 37 ) parameter; 38 39 /* EXTERNAL ENTRIES */ 40 dcl convert_status_code_ entry(fixed bin(35), char(8) aligned, char(100) aligned); 41 dcl expand_path_ entry(ptr, fixed bin, ptr, ptr, fixed bin(35)); 42 dcl get_pdir_ entry returns(char(168) aligned), 43 get_wdir_ entry returns(char(168) aligned); 44 dcl ioa_$ioa_stream entry options(variable); 45 dcl unique_chars_ entry(bit(*)) returns(char(15)); 46 47 dcl sort_merge_initiate entry(ptr, ptr, char(*), fixed bin(35)); 48 49 /* EXTERNAL STATIC */ 50 1 1 dcl 1 sort_ext$acl(1) ext, 1 2 2 x_user_id char(32), 1 3 2 x_modes bit(36), 1 4 2 x_pad bit(36), 1 5 2 x_acl_code fixed bin(35); 1 6 dcl 1 acl(1) 1 7 defined(sort_ext$acl), 1 8 2 user_id char(32), 1 9 2 modes bit(36), 1 10 2 pad bit(36), 1 11 2 acl_code fixed bin(35); 1 12 dcl sort_ext$b(0: 31) fixed bin(30) ext; /* keys - bit offset (usually) for sort_comp */ 1 13 dcl b(0: 31) fixed bin(30) 1 14 defined (sort_ext$b); 1 15 dcl sort_ext$compares_counter fixed bin(34) ext; /* compares executed, excluding sequence checker */ 1 16 dcl compares_counter fixed bin(34) 1 17 defined(sort_ext$compares_counter); 1 18 dcl sort_ext$compare_sw fixed bin(1) ext; /* 1 = user compare exit specified */ 1 19 dcl compare_sw fixed bin(1) 1 20 defined (sort_ext$compare_sw); 1 21 dcl sort_ext$curr_input_file_attach char(256) ext; /* attach description, current input file (Sort) */ 1 22 dcl curr_input_file_attach char(256) 1 23 defined(sort_ext$curr_input_file_attach); 1 24 dcl sort_ext$curr_input_file_name char(256) ext; /* pathname, current input file (Sort) */ 1 25 dcl curr_input_file_name char(256) 1 26 defined (sort_ext$curr_input_file_name); 1 27 dcl sort_ext$curr_input_file_num fixed bin(17) ext; /* number for current input file (Sort) */ 1 28 dcl curr_input_file_num fixed bin(17) 1 29 defined (sort_ext$curr_input_file_num); 1 30 dcl sort_ext$curr_output_file_attach char(256) ext; /* attach description, output file */ 1 31 dcl curr_output_file_attach char(256) 1 32 defined(sort_ext$curr_output_file_attach); 1 33 dcl sort_ext$curr_output_file_name char(256) ext; /* pathname, output file */ 1 34 dcl curr_output_file_name char(256) 1 35 defined (sort_ext$curr_output_file_name); 1 36 dcl sort_ext$debug_sw bit(1) ext; /* 1 = -debug argument specified */ 1 37 dcl debug_sw bit(1) 1 38 defined(sort_ext$debug_sw); 1 39 dcl sort_ext$disaster2 fixed bin(17) ext; /* 0 = first call to sort_return or merge_return */ 1 40 dcl disaster2 fixed bin(17) 1 41 defined (sort_ext$disaster2); 1 42 dcl sort_ext$dt(0: 31) fixed bin(30) ext; /* keys - datatype for sort_comp */ 1 43 dcl dt(0: 31) fixed bin(30) 1 44 defined (sort_ext$dt); 1 45 dcl sort_ext$input_driver_is_sort bit(1) ext; /* 1 = Sort reads input files, 0 = input_file exit */ 1 46 dcl input_driver_is_sort bit(1) 1 47 defined(sort_ext$input_driver_is_sort); 1 48 dcl sort_ext$input_file_exit_sw bit(1) ext; /* 1 = user input_file exit specified */ 1 49 dcl input_file_exit_sw bit(1) 1 50 defined(sort_ext$input_file_exit_sw); 1 51 dcl sort_ext$input_file_max fixed bin(17) ext; /* number of input files specified [init(10)] */ 1 52 /* must also change merge_return: merge_read_count & input_file_len */ 1 53 dcl input_file_max fixed bin(17) 1 54 defined(sort_ext$input_file_max); 1 55 dcl sort_ext$input_record_exit_sw fixed bin(1) ext; /* 1 = user input_record exit specified */ 1 56 dcl input_record_exit_sw fixed bin(1) 1 57 defined(sort_ext$input_record_exit_sw); 1 58 dcl sort_ext$input_rec_deleted fixed bin(30) ext; /* number of records deleted at input_record exit */ 1 59 dcl input_rec_deleted fixed bin(30) 1 60 defined(sort_ext$input_rec_deleted); 1 61 dcl sort_ext$input_rec_inserted fixed bin(30) ext; /* number of records inserted _record exit */ 1 62 dcl input_rec_inserted fixed bin(30) 1 63 defined(sort_ext$input_rec_inserted); 1 64 dcl sort_ext$in_buff_ptr ptr ext; /* buffer for an input record (Sort or Merge reading) */ 1 65 dcl in_buff_ptr ptr 1 66 defined (sort_ext$in_buff_ptr); 1 67 dcl sort_ext$leng(0: 31) fixed bin(30) ext; /* keys - length or precision for sort_comp */ 1 68 dcl leng(0: 31) fixed bin(30) 1 69 defined (sort_ext$leng); 1 70 dcl sort_ext$max1 fixed bin(30) ext; /* limits size of unsorted string SS (sort_release) */ 1 71 dcl max1 fixed bin(30) 1 72 defined (sort_ext$max1); 1 73 dcl sort_ext$max2 fixed bin(30) ext; /* limits size of unsorted string SS (sort_release) */ 1 74 dcl max2 fixed bin(30) 1 75 defined (sort_ext$max2); 1 76 dcl sort_ext$max3 fixed bin(30) ext; /* maximum number of records per string SS */ 1 77 dcl max3 fixed bin(30) 1 78 defined (sort_ext$max3); 1 79 dcl sort_ext$max4 fixed bin(30) ext; /* maximum merge order allowed (sort_presort) */ 1 80 dcl max4 fixed bin(30) 1 81 defined (sort_ext$max4); 1 82 dcl sort_ext$max_rec_length fixed bin(30) ext; /* maximum record length permitted by Sort or Merge; */ 1 83 /* slightly less than sys_info$max_seg_size */ 1 84 dcl max_rec_length fixed bin(30) 1 85 defined (sort_ext$max_rec_length); 1 86 dcl sort_ext$merge_compares fixed bin(34) ext; /* number of compares in merge */ 1 87 dcl merge_compares fixed bin(34) 1 88 defined(sort_ext$merge_compares); 1 89 dcl sort_ext$merge_in_iocb_ptrs(10) ptr ext; /* iox_ iocb's for Merge input files */ 1 90 dcl merge_in_iocb_ptrs(10) ptr 1 91 defined(sort_ext$merge_in_iocb_ptrs); 1 92 dcl sort_ext$merge_input_file_attaches(10) char(256) ext; /* attach descriptions, Merge input files */ 1 93 dcl merge_input_file_attaches(10) char(256) 1 94 defined(sort_ext$merge_input_file_attaches); 1 95 dcl sort_ext$merge_input_file_names(10) char(256) ext; /* pathnames, Merge input files */ 1 96 dcl merge_input_file_names(10) char(256) 1 97 defined(sort_ext$merge_input_file_names); 1 98 dcl sort_ext$mii fixed bin(17) ext; /* merge order for Sort [init(0)] */ 1 99 dcl mii fixed bin(17) 1 100 defined (sort_ext$mii); 1 101 dcl sort_ext$min_rec_length fixed bin(30) ext; /* record length required to include all key fields */ 1 102 dcl min_rec_length fixed bin(30) 1 103 defined (sort_ext$min_rec_length); 1 104 dcl sort_ext$mip (1000) fixed bin(30) ext; /* number of records in each string MS for merge */ 1 105 dcl mip (1000) fixed bin(30) 1 106 defined (sort_ext$mip); 1 107 dcl sort_ext$msp (1000) ptr ext; /* sorted strings MS(1:mii) to be merged */ 1 108 dcl msp (1000) ptr 1 109 defined (sort_ext$msp); 1 110 dcl sort_ext$no_of_keys fixed bin(30) ext; /* number of keys specified */ 1 111 dcl no_of_keys fixed bin(30) 1 112 defined(sort_ext$no_of_keys); 1 113 dcl sort_ext$old_input_file_num fixed bin(17) ext; /* used for identifying files with bad key data */ 1 114 dcl old_input_file_num fixed bin(17) /* (illegal_procedure handler in sort_presort) */ 1 115 defined(sort_ext$old_input_file_num); 1 116 dcl sort_ext$output_driver_is_sort bit(1) ext; /* 1 = Sort or Merge writes output file; */ 1 117 dcl output_driver_is_sort bit(1) /* 0 = output_file exit */ 1 118 defined(sort_ext$output_driver_is_sort); 1 119 dcl sort_ext$output_file_exit_sw bit(1) ext; /* 1 = user output_file exit specified */ 1 120 dcl output_file_exit_sw bit(1) 1 121 defined(sort_ext$output_file_exit_sw); 1 122 dcl sort_ext$output_rec_deleted fixed bin(30) ext; /* number of records deleted at output_record exit */ 1 123 dcl output_rec_deleted fixed bin(30) 1 124 defined(sort_ext$output_rec_deleted); 1 125 dcl sort_ext$output_rec_inserted fixed bin(30) ext; /* number of record inserted at output_record exit */ 1 126 dcl output_rec_inserted fixed bin(30) 1 127 defined(sort_ext$output_rec_inserted); 1 128 dcl sort_ext$output_record_exit_sw fixed bin(1) ext; /* 1 = user output_record exit specified */ 1 129 dcl output_record_exit_sw fixed bin(1) 1 130 defined(sort_ext$output_record_exit_sw); 1 131 dcl sort_ext$presort_compares fixed bin(34) ext; /* number of compares in presort */ 1 132 dcl presort_compares fixed bin(34) 1 133 defined(sort_ext$presort_compares); 1 134 dcl 1 sort_ext$pu(5) ext, 1 135 2 x_n fixed bin, /* [init((5) 1)] */ 1 136 2 x_rcpu fixed bin(71); 1 137 dcl 1 pu(5) 1 138 defined(sort_ext$pu), 1 139 2 n fixed bin, 1 140 2 rcpu fixed bin(71); 1 141 dcl sort_ext$read_count fixed bin(30) ext; /* number of records read by Sort (or by Merge) */ 1 142 dcl read_count fixed bin(30) 1 143 defined (sort_ext$read_count); 1 144 dcl sort_ext$rec_ptr_a ptr ext; /* buffer for output_record exit and sequence checker */ 1 145 dcl rec_ptr_a ptr 1 146 defined(sort_ext$rec_ptr_a); 1 147 dcl sort_ext$rec_ptr_b ptr ext; /* buffer for output_record exit and sequence checker */ 1 148 dcl rec_ptr_b ptr 1 149 defined(sort_ext$rec_ptr_b); 1 150 dcl sort_ext$release_count fixed bin(30) ext; /* number of records released to Sort (Merge) */ 1 151 dcl release_count fixed bin(30) 1 152 defined (sort_ext$release_count); 1 153 dcl sort_ext$report_sw bit(2) ext; /* 00 = print summary report, 01 = suppress */ 1 154 dcl report_sw bit(2) 1 155 defined (sort_ext$report_sw); 1 156 dcl sort_ext$return_count fixed bin(30) ext; /* number of records returned from Sort (Merge) */ 1 157 dcl return_count fixed bin(30) 1 158 defined (sort_ext$return_count); 1 159 dcl sort_ext$rev(0: 31) fixed bin(1) ext; /* keys - descending indicator for sort_comp */ 1 160 dcl rev(0: 31) fixed bin(1) 1 161 defined (sort_ext$rev); 1 162 dcl sort_ext$sii fixed bin(30) ext; /* number of records, current string (sort_release) */ 1 163 dcl sii fixed bin(30) 1 164 defined (sort_ext$sii); 1 165 dcl sort_ext$sip ptr ext; /* SI - tree of indices (subscripts) for records */ 1 166 dcl sip ptr /* being sorted or merged */ 1 167 defined (sort_ext$sip); 1 168 dcl sort_ext$sort_compare_exit variable /* entry point, user compare exit procedure */ 1 169 entry(ptr, ptr) returns(fixed bin(1)) ext; 1 170 dcl sort_ext$sort_desc_pn char(168) ext; /* pathname, Sort (Merge) Description segment */ 1 171 dcl sort_desc_pn char(168) 1 172 defined(sort_ext$sort_desc_pn); 1 173 dcl sort_ext$sort_input_record_exit variable /* entry point, user input_record exit procedure */ 1 174 entry(ptr, fixed bin(21), fixed bin, bit(1)) ext; 1 175 dcl sort_input_record_exit variable 1 176 entry(ptr, fixed bin(21), fixed bin, bit(1)) 1 177 defined(sort_ext$sort_input_record_exit); 1 178 dcl sort_ext$sort_output_record_exit variable /* entry point, user output_record exit procedure */ 1 179 entry(ptr, fixed bin(21), ptr, fixed bin(21), fixed bin, fixed bin(1), bit(1), bit(1), bit(1)) ext; 1 180 dcl sort_output_record_exit variable 1 181 entry(ptr, fixed bin(21), ptr, fixed bin(21), fixed bin, fixed bin(1), bit(1), bit(1), bit(1)) 1 182 defined(sort_ext$sort_output_record_exit); 1 183 dcl sort_ext$srp ptr ext; /* SR - position and length of each record */ 1 184 dcl srp ptr /* in SS string for presort */ 1 185 defined (sort_ext$srp); 1 186 dcl sort_ext$ssi fixed bin(30) ext; /* char offset in SS of current record (sort_release) */ 1 187 dcl ssi fixed bin(30) 1 188 defined (sort_ext$ssi); 1 189 dcl sort_ext$ssp ptr ext; /* SS - unsorted string during presort */ 1 190 dcl ssp ptr 1 191 defined (sort_ext$ssp); 1 192 dcl sort_ext$state fixed bin(17) ext; /* state variable controlling sequence of calls to */ 1 193 dcl state fixed bin(17) /* the various stages of the Sort (Merge) [init(0)] */ 1 194 defined (sort_ext$state); 1 195 dcl sort_ext$terminate_print_sw bit(1) ext; /* 0 = command prints (sort_merge_print_report) */ 1 196 dcl terminate_print_sw bit(1) /* 1 = subroutine prints (sort_merge_terminate) */ 1 197 defined (sort_ext$terminate_print_sw); 1 198 dcl 1 sort_ext$time_info(5) ext, /* used for -time information */ 1 199 2 x_etime fixed bin(71), 1 200 2 x_vtime fixed bin(71), 1 201 2 x_pf fixed bin, 1 202 2 x_pd_f fixed bin; 1 203 dcl 1 time_info(5) 1 204 defined(sort_ext$time_info), 1 205 2 etime fixed bin(71), 1 206 2 vtime fixed bin(71), 1 207 2 pf fixed bin, 1 208 2 pd_f fixed bin; 1 209 dcl sort_ext$time_sw bit(1) ext; /* 1 = -time argument specified */ 1 210 dcl time_sw bit(1) 1 211 defined(sort_ext$time_sw); 1 212 dcl sort_ext$user_out_sw char(32) ext; /* I/O switch for summary report, diagnostics: */ 1 213 dcl user_out_sw char(32) /* "user_output", "" = suppress, other = user switch */ 1 214 defined(sort_ext$user_out_sw); 1 215 dcl sort_ext$unique_prefix char(16) ext; /* unique to each invocation, for temporary names */ 1 216 dcl unique_prefix char(16) 1 217 defined (sort_ext$unique_prefix); /* -4- */ 1 218 dcl sort_ext$w(0: 31) fixed bin(30) ext; /* keys - word (sometimes char) offset for sort_comp */ 1 219 dcl w(0: 31) fixed bin(30) 1 220 defined (sort_ext$w); 1 221 dcl sort_ext$wf_dir_name char(168) aligned ext; /* -td directory pathname argument */ 1 222 dcl wf_dir_name char(168) aligned 1 223 defined(sort_ext$wf_dir_name); 1 224 dcl sort_ext$wf_full_name char(168) ext; /* absolute -td directory pathname */ 1 225 dcl wf_full_name char(168) 1 226 defined (sort_ext$wf_full_name); /* -42- */ 1 227 dcl sort_ext$whoami char(6) ext; /* "sort", "merge", "sort_", "merge_" called */ 1 228 dcl whoami char(6) 1 229 defined (sort_ext$whoami); /* -2- */ 1 230 dcl sort_ext$write_count fixed bin(30) ext; /* number of records written by Sort (Merge) */ 1 231 dcl write_count fixed bin(30) 1 232 defined (sort_ext$write_count); 51 52 53 dcl sys_info$max_seg_size fixed bin(35) external static; 54 dcl (error_table_$pathlong, 55 error_table_$bad_arg, 56 error_table_$out_of_sequence) fixed bin(35) external static; 57 58 /* INTERNAL STATIC (constants only) */ 59 dcl (on bit(1) init("1"b), 60 off bit(1) init("0"b) ) internal static; 61 62 /* AUTOMATIC and BASED */ 63 dcl file_size_temp fixed bin(71); /* Temporary location for file size - in bytes */ 64 dcl merge_order fixed bin(35), 65 string_size fixed bin(35); 66 67 dcl state_code fixed bin(35); 68 dcl arg_err_sw bit(1); 69 dcl expand_path_code fixed bin(35); 70 dcl shortinfo char(8) aligned, 71 longinfo char(100) aligned; 72 dcl keys_ptr_pass ptr, /* Arguments passed to sort_merge_initiate. */ 73 exits_ptr_pass ptr, 74 user_out_sw_pass char(32), 75 s_m_init_code fixed bin(35); 76 dcl (addr, before, ceil, divide, index, length, min, null, sqrt) builtin; 77 78 /* Start. */ 79 80 call state_test(state_code); 81 if state_code ^= 0 then do; 82 code = error_table_$out_of_sequence; 83 return; /* to caller without resetting state variable */ 84 end; 85 state = 3; 86 if user_out_sw_par = "" then user_out_sw = "user_output"; 87 else if user_out_sw_par = "-bf" | user_out_sw_par = "-brief" then user_out_sw = ""; 88 else user_out_sw = user_out_sw_par; 89 merge_order = 0; /* Merge order not specified. */ 90 string_size = 0; /* String_size not specified. */ 91 time_sw = off; /* Timing not specified. */ 92 debug_sw = off; /* Debug optionn not specified. */ 93 terminate_print_sw = on; /* sort_terminate should print Sort Report. */ 94 95 common_start: 96 code = 0; 97 file_size_temp = file_size_par * 10**6 + 1; 98 arg_err_sw = off; 99 old_input_file_num = 1; /* For sort_presort's illegal_procedure handler. */ 100 101 call initialize_presort; 102 103 keys_ptr_pass = keys_ptr; 104 exits_ptr_pass = exits_ptr; 105 user_out_sw_pass = user_out_sw; 106 s_m_init_code = 0; 107 call sort_merge_initiate(keys_ptr_pass, exits_ptr_pass, user_out_sw_pass, s_m_init_code); 108 109 /* temp_dir: */ 110 call get_wf_dir_name; 111 112 exit: 113 if s_m_init_code ^= 0 then code = s_m_init_code; 114 if arg_err_sw = on then code = error_table_$bad_arg; 115 return; 116 117 118 /* ENTRY internal to the Sort; called only by sort_ subroutine. */ 119 initiate_private: entry(temp_dir, keys_ptr, exits_ptr, user_out_sw_par, file_size_par, 120 code, merge_order_par, string_size_par); 121 dcl (merge_order_par fixed bin(35), /* Way of the merge. */ 122 string_size_par fixed bin(35) ) parameter; /* Presort string size in bytes. */ 123 /* user_out_sw_par ignored; sort_ has already set user_out_sw properly. */ 124 /* time_sw, debug_sw already set. */ 125 state = 3; 126 terminate_print_sw = off; /* sort_ should print Sort Report. */ 127 merge_order = merge_order_par; 128 string_size = string_size_par; 129 go to common_start; 130 131 132 state_test: proc(state_code); 133 dcl state_code fixed bin(35) parameter; 134 if state = 0 135 | (state = 8 & index(whoami, "_") ^= 0) /* subroutine was called last */ 136 then do; 137 unique_prefix = before(unique_chars_("0"b), " ")||"."; 138 whoami = "sort_"; 139 state_code = 0; 140 end; 141 else do; /* Error */ 142 state_code = 1; 143 return; 144 end; 145 end state_test; 146 147 148 get_wf_dir_name: proc; 149 150 if temp_dir = "" | temp_dir = "-pd" | temp_dir = "-process_directory" | temp_dir = "-process_dir" then 151 /* process directory */ 152 do; 153 wf_dir_name = get_pdir_(); 154 end; 155 156 else if temp_dir = "-wd" | temp_dir = "-working_directory" | temp_dir = "-working_dir" then 157 /* current working directory */ 158 do; 159 wf_dir_name = get_wdir_(); 160 end; 161 162 else 163 /* Convert to absolute path name. */ 164 do; 165 call expand_path_(addr(temp_dir), length(temp_dir), 166 addr(wf_dir_name), null(), expand_path_code); 167 if expand_path_code ^= 0 then 168 do; 169 /* error_table_$badpath 170* $dirlong 171* $lesserr 172* $pathlong */ 173 call convert_status_code_(expand_path_code, shortinfo, longinfo); 174 if user_out_sw ^= "" then call ioa_$ioa_stream(user_out_sw, 175 "^a: ^a Temporary directory pathname ^a", 176 whoami, longinfo, temp_dir); 177 arg_err_sw = on; 178 return; 179 end; 180 end; 181 wf_full_name = before(wf_dir_name, " ")||">"||unique_prefix||"sort_work."; 182 if index(wf_full_name, " ") = 0 | index(wf_full_name, " ") > 160 then do; 183 /* Error: work file directory name potentially too long */ 184 call convert_status_code_(error_table_$pathlong, shortinfo, longinfo); 185 if user_out_sw ^= "" then call ioa_$ioa_stream(user_out_sw, 186 "^a: ^a Pathname and prefix for work files ^a", 187 whoami, longinfo, wf_full_name); 188 arg_err_sw = on; 189 end; 190 end get_wf_dir_name; 191 192 initialize_presort: proc; 193 /* this procedure will initialize the necessary variables to perform the sort */ 194 disaster2 = 0; /* return state - =first call, 1 =later call, 2 = last call */ 195 mii = 0; /* number of merge strings produced */ 196 sip = null(); /* for sort_cleanup_proc in case release not called */ 197 ssi = 0; 198 sii = 0; 199 max1 = (sys_info$max_seg_size -100)*4; 200 max3 = divide(sys_info$max_seg_size - 100, 3, 24, 0); 201 max4 = 999; /* maximum merge order */ 202 call compute_string_size; 203 end initialize_presort; 204 205 206 compute_string_size: proc; 207 dcl MAX_WORK_SEGMENT_SIZE_64K fixed bin (21) int static options (constant) init (4096*64); /* 64 pages */ 208 dcl MAX_WORK_SEGMENT_SIZE_255K fixed bin (21) int static options (constant) init (4096*255); /* 255 pages */ 209 dcl (number_64k_segs, number_255k_segs) fixed bin (30); 210 if file_size_temp < 50 then file_size_temp = 1.04*10**6; /* Default */ 211 if merge_order < 1 & string_size < 1 then /* Caller did not specify; base string size on file size */ 212 if file_size_temp <= 4096 then max2 = 4096; 213 else do; 214 max2 = ceil(sqrt(divide(file_size_temp, 4096, 71, 36))) * 4096; 215 if max2 > MAX_WORK_SEGMENT_SIZE_64K /* work segs larger than 64 pages */ 216 then do; 217 number_64k_segs = divide (max2, MAX_WORK_SEGMENT_SIZE_64K, 30, 0) + 1; 218 number_255k_segs = divide (number_64k_segs, 4, 30, 0) + 1; 219 if number_64k_segs > max4 220 then if number_255k_segs > max4 221 then do; 222 max2 = MAX_WORK_SEGMENT_SIZE_255K; /* size of a single work segment */ 223 max4 = number_255k_segs; /* need this many work segments */ 224 end; 225 else max2 = MAX_WORK_SEGMENT_SIZE_255K; /* have to use 255k segs */ 226 else max2 = MAX_WORK_SEGMENT_SIZE_64K; /* use 64k work segs to prevent 255k ASTE thrashing */ 227 end; 228 end; 229 else if merge_order < 1 & string_size > 0 then do; /* User specified string size */ 230 max2 = string_size; 231 if max2 > max1 + 200 then do; 232 arg_err_sw = on; 233 if user_out_sw ^= "" then call ioa_$ioa_stream(user_out_sw, 234 "^a: Invalid string_size argument ^d. Must be < ^d.", 235 whoami, max2, max1 + 201); 236 end; 237 end; 238 else if merge_order > 0 & string_size < 1 then do; /* User specified merge order */ 239 max2 = divide(file_size_temp, merge_order, 71, 36); /* Compute corresponding string size */ 240 if max2 > max1 + 200 then do; 241 arg_err_sw = on; 242 if user_out_sw ^= "" then call ioa_$ioa_stream(user_out_sw, 243 "^a: File size too large for specified merge_order argument ^d.", 244 whoami, merge_order); 245 end; 246 end; 247 else do; 248 arg_err_sw = on; 249 if user_out_sw ^= "" then call ioa_$ioa_stream(user_out_sw, 250 "^a: Both merge_order and string_size arguments specified.", 251 whoami); 252 end; 253 end compute_string_size; 254 255 256 end initiate; SOURCE FILES USED IN THIS COMPILATION. LINE NUMBER DATE MODIFIED NAME PATHNAME 0 02/14/84 0736.1 sort_initiate.pl1 >special_ldd>on>6617>sort_initiate.pl1 51 1 12/20/77 1614.2 sort_ext.incl.pl1 >ldd>include>sort_ext.incl.pl1 NAMES DECLARED IN THIS COMPILATION. IDENTIFIER OFFSET LOC STORAGE CLASS DATA TYPE ATTRIBUTES AND REFERENCES (* indicates a set context) NAMES DECLARED BY DECLARE STATEMENT. MAX_WORK_SEGMENT_SIZE_255K 000000 constant fixed bin(21,0) initial dcl 208 ref 222 225 MAX_WORK_SEGMENT_SIZE_64K constant fixed bin(21,0) initial dcl 207 ref 215 217 226 addr builtin function dcl 76 ref 165 165 165 165 arg_err_sw 000105 automatic bit(1) unaligned dcl 68 set ref 98* 114 177* 188* 232* 241* 248* before builtin function dcl 76 ref 137 181 ceil builtin function dcl 76 ref 214 code parameter fixed bin(35,0) dcl 25 set ref 22 82* 95* 112* 114* 119 convert_status_code_ 000012 constant entry external dcl 40 ref 173 184 debug_sw defined bit(1) unaligned dcl 1-37 set ref 92* disaster2 defined fixed bin(17,0) dcl 1-40 set ref 194* divide builtin function dcl 76 ref 200 214 217 218 239 error_table_$bad_arg 000102 external static fixed bin(35,0) dcl 54 ref 114 error_table_$out_of_sequence 000104 external static fixed bin(35,0) dcl 54 ref 82 error_table_$pathlong 000100 external static fixed bin(35,0) dcl 54 set ref 184* exits_ptr parameter pointer dcl 25 ref 22 104 119 exits_ptr_pass 000146 automatic pointer dcl 72 set ref 104* 107* expand_path_ 000014 constant entry external dcl 41 ref 165 expand_path_code 000106 automatic fixed bin(35,0) dcl 69 set ref 165* 167 173* file_size_par parameter float bin(27) dcl 25 ref 22 97 119 file_size_temp 000100 automatic fixed bin(71,0) dcl 63 set ref 97* 210 210* 211 214 239 get_pdir_ 000016 constant entry external dcl 42 ref 153 get_wdir_ 000020 constant entry external dcl 42 ref 159 index builtin function dcl 76 ref 134 182 182 ioa_$ioa_stream 000022 constant entry external dcl 44 ref 174 185 233 242 249 keys_ptr parameter pointer dcl 25 ref 22 103 119 keys_ptr_pass 000144 automatic pointer dcl 72 set ref 103* 107* length builtin function dcl 76 ref 165 165 longinfo 000112 automatic char(100) dcl 70 set ref 173* 174* 184* 185* max1 defined fixed bin(30,0) dcl 1-71 set ref 199* 231 233 240 max2 defined fixed bin(30,0) dcl 1-74 set ref 211* 214* 215 217 222* 225* 226* 230* 231 233* 239* 240 max3 defined fixed bin(30,0) dcl 1-77 set ref 200* max4 defined fixed bin(30,0) dcl 1-80 set ref 201* 219 219 223* merge_order 000102 automatic fixed bin(35,0) dcl 64 set ref 89* 127* 211 229 238 239 242* merge_order_par parameter fixed bin(35,0) dcl 121 ref 119 127 mii defined fixed bin(17,0) dcl 1-99 set ref 195* null builtin function dcl 76 ref 165 165 196 number_255k_segs 000213 automatic fixed bin(30,0) dcl 209 set ref 218* 219 223 number_64k_segs 000212 automatic fixed bin(30,0) dcl 209 set ref 217* 218 219 off constant bit(1) initial unaligned dcl 59 ref 91 92 98 126 old_input_file_num defined fixed bin(17,0) dcl 1-114 set ref 99* on constant bit(1) initial unaligned dcl 59 ref 93 114 177 188 232 241 248 s_m_init_code 000160 automatic fixed bin(35,0) dcl 72 set ref 106* 107* 112 112 shortinfo 000110 automatic char(8) dcl 70 set ref 173* 184* sii defined fixed bin(30,0) dcl 1-163 set ref 198* sip defined pointer dcl 1-166 set ref 196* sort_ext$debug_sw 000030 external static bit(1) unaligned dcl 1-36 set ref 92* 92 sort_ext$disaster2 000032 external static fixed bin(17,0) dcl 1-39 set ref 194* 194 sort_ext$max1 000034 external static fixed bin(30,0) dcl 1-70 set ref 199* 199 231 231 233 233 240 240 sort_ext$max2 000036 external static fixed bin(30,0) dcl 1-73 set ref 211* 211 214* 214 215 215 217 217 222* 222 225* 225 226* 226 230* 230 231 231 233 233 239* 239 240 240 sort_ext$max3 000040 external static fixed bin(30,0) dcl 1-76 set ref 200* 200 sort_ext$max4 000042 external static fixed bin(30,0) dcl 1-79 set ref 201* 201 219 219 219 219 223* 223 sort_ext$mii 000044 external static fixed bin(17,0) dcl 1-98 set ref 195* 195 sort_ext$old_input_file_num 000046 external static fixed bin(17,0) dcl 1-113 set ref 99* 99 sort_ext$sii 000050 external static fixed bin(30,0) dcl 1-162 set ref 198* 198 sort_ext$sip 000052 external static pointer dcl 1-165 set ref 196* 196 sort_ext$ssi 000054 external static fixed bin(30,0) dcl 1-186 set ref 197* 197 sort_ext$state 000056 external static fixed bin(17,0) dcl 1-192 set ref 85* 85 125* 125 134 134 134 134 sort_ext$terminate_print_sw 000060 external static bit(1) unaligned dcl 1-195 set ref 93* 93 126* 126 sort_ext$time_sw 000062 external static bit(1) unaligned dcl 1-209 set ref 91* 91 sort_ext$unique_prefix 000066 external static char(16) unaligned dcl 1-215 set ref 137* 137 181 181 sort_ext$user_out_sw 000064 external static char(32) unaligned dcl 1-212 set ref 86* 86 87* 87 88* 88 105 105 174 174 174 174 185 185 185 185 233 233 233 233 242 242 242 242 249 249 249 249 sort_ext$wf_dir_name 000070 external static char(168) dcl 1-221 set ref 153* 153 159* 159 165 165 165 165 181 181 sort_ext$wf_full_name 000072 external static char(168) unaligned dcl 1-224 set ref 181* 181 182 182 182 182 185 185 sort_ext$whoami 000074 external static char(6) unaligned dcl 1-227 set ref 134 134 138* 138 174 174 185 185 233 233 242 242 249 249 sort_merge_initiate 000026 constant entry external dcl 47 ref 107 sqrt builtin function dcl 76 ref 214 ssi defined fixed bin(30,0) dcl 1-187 set ref 197* state defined fixed bin(17,0) dcl 1-193 set ref 85* 125* 134 134 state_code 000104 automatic fixed bin(35,0) dcl 67 in procedure "initiate" set ref 80* 81 state_code parameter fixed bin(35,0) dcl 133 in procedure "state_test" set ref 132 139* 142* string_size 000103 automatic fixed bin(35,0) dcl 64 set ref 90* 128* 211 229 230 238 string_size_par parameter fixed bin(35,0) dcl 121 ref 119 128 sys_info$max_seg_size 000076 external static fixed bin(35,0) dcl 53 ref 199 200 temp_dir parameter char unaligned dcl 25 set ref 22 119 150 150 150 150 156 156 156 165 165 165 165 174* terminate_print_sw defined bit(1) unaligned dcl 1-196 set ref 93* 126* time_sw defined bit(1) unaligned dcl 1-210 set ref 91* unique_chars_ 000024 constant entry external dcl 45 ref 137 unique_prefix defined char(16) unaligned dcl 1-216 set ref 137* 181 user_out_sw defined char(32) unaligned dcl 1-213 set ref 86* 87* 88* 105 174 174* 185 185* 233 233* 242 242* 249 249* user_out_sw_par parameter char unaligned dcl 25 ref 22 86 87 87 88 119 user_out_sw_pass 000150 automatic char(32) unaligned dcl 72 set ref 105* 107* wf_dir_name defined char(168) dcl 1-222 set ref 153* 159* 165 165 181 wf_full_name defined char(168) unaligned dcl 1-225 set ref 181* 182 182 185* whoami defined char(6) unaligned dcl 1-228 set ref 134 138* 174* 185* 233* 242* 249* NAMES DECLARED BY DECLARE STATEMENT AND NEVER REFERENCED. acl defined structure array level 1 unaligned dcl 1-6 b defined fixed bin(30,0) array dcl 1-13 compare_sw defined fixed bin(1,0) dcl 1-19 compares_counter defined fixed bin(34,0) dcl 1-16 curr_input_file_attach defined char(256) unaligned dcl 1-22 curr_input_file_name defined char(256) unaligned dcl 1-25 curr_input_file_num defined fixed bin(17,0) dcl 1-28 curr_output_file_attach defined char(256) unaligned dcl 1-31 curr_output_file_name defined char(256) unaligned dcl 1-34 dt defined fixed bin(30,0) array dcl 1-43 in_buff_ptr defined pointer dcl 1-65 input_driver_is_sort defined bit(1) unaligned dcl 1-46 input_file_exit_sw defined bit(1) unaligned dcl 1-49 input_file_max defined fixed bin(17,0) dcl 1-53 input_rec_deleted defined fixed bin(30,0) dcl 1-59 input_rec_inserted defined fixed bin(30,0) dcl 1-62 input_record_exit_sw defined fixed bin(1,0) dcl 1-56 leng defined fixed bin(30,0) array dcl 1-68 max_rec_length defined fixed bin(30,0) dcl 1-84 merge_compares defined fixed bin(34,0) dcl 1-87 merge_in_iocb_ptrs defined pointer array dcl 1-90 merge_input_file_attaches defined char(256) array unaligned dcl 1-93 merge_input_file_names defined char(256) array unaligned dcl 1-96 min builtin function dcl 76 min_rec_length defined fixed bin(30,0) dcl 1-102 mip defined fixed bin(30,0) array dcl 1-105 msp defined pointer array dcl 1-108 no_of_keys defined fixed bin(30,0) dcl 1-111 output_driver_is_sort defined bit(1) unaligned dcl 1-117 output_file_exit_sw defined bit(1) unaligned dcl 1-120 output_rec_deleted defined fixed bin(30,0) dcl 1-123 output_rec_inserted defined fixed bin(30,0) dcl 1-126 output_record_exit_sw defined fixed bin(1,0) dcl 1-129 presort_compares defined fixed bin(34,0) dcl 1-132 pu defined structure array level 1 unaligned dcl 1-137 read_count defined fixed bin(30,0) dcl 1-142 rec_ptr_a defined pointer dcl 1-145 rec_ptr_b defined pointer dcl 1-148 release_count defined fixed bin(30,0) dcl 1-151 report_sw defined bit(2) unaligned dcl 1-154 return_count defined fixed bin(30,0) dcl 1-157 rev defined fixed bin(1,0) array dcl 1-160 sort_desc_pn defined char(168) unaligned dcl 1-171 sort_ext$acl external static structure array level 1 unaligned dcl 1-1 sort_ext$b external static fixed bin(30,0) array dcl 1-12 sort_ext$compare_sw external static fixed bin(1,0) dcl 1-18 sort_ext$compares_counter external static fixed bin(34,0) dcl 1-15 sort_ext$curr_input_file_attach external static char(256) unaligned dcl 1-21 sort_ext$curr_input_file_name external static char(256) unaligned dcl 1-24 sort_ext$curr_input_file_num external static fixed bin(17,0) dcl 1-27 sort_ext$curr_output_file_attach external static char(256) unaligned dcl 1-30 sort_ext$curr_output_file_name external static char(256) unaligned dcl 1-33 sort_ext$dt external static fixed bin(30,0) array dcl 1-42 sort_ext$in_buff_ptr external static pointer dcl 1-64 sort_ext$input_driver_is_sort external static bit(1) unaligned dcl 1-45 sort_ext$input_file_exit_sw external static bit(1) unaligned dcl 1-48 sort_ext$input_file_max external static fixed bin(17,0) dcl 1-51 sort_ext$input_rec_deleted external static fixed bin(30,0) dcl 1-58 sort_ext$input_rec_inserted external static fixed bin(30,0) dcl 1-61 sort_ext$input_record_exit_sw external static fixed bin(1,0) dcl 1-55 sort_ext$leng external static fixed bin(30,0) array dcl 1-67 sort_ext$max_rec_length external static fixed bin(30,0) dcl 1-82 sort_ext$merge_compares external static fixed bin(34,0) dcl 1-86 sort_ext$merge_in_iocb_ptrs external static pointer array dcl 1-89 sort_ext$merge_input_file_attaches external static char(256) array unaligned dcl 1-92 sort_ext$merge_input_file_names external static char(256) array unaligned dcl 1-95 sort_ext$min_rec_length external static fixed bin(30,0) dcl 1-101 sort_ext$mip external static fixed bin(30,0) array dcl 1-104 sort_ext$msp external static pointer array dcl 1-107 sort_ext$no_of_keys external static fixed bin(30,0) dcl 1-110 sort_ext$output_driver_is_sort external static bit(1) unaligned dcl 1-116 sort_ext$output_file_exit_sw external static bit(1) unaligned dcl 1-119 sort_ext$output_rec_deleted external static fixed bin(30,0) dcl 1-122 sort_ext$output_rec_inserted external static fixed bin(30,0) dcl 1-125 sort_ext$output_record_exit_sw external static fixed bin(1,0) dcl 1-128 sort_ext$presort_compares external static fixed bin(34,0) dcl 1-131 sort_ext$pu external static structure array level 1 unaligned dcl 1-134 sort_ext$read_count external static fixed bin(30,0) dcl 1-141 sort_ext$rec_ptr_a external static pointer dcl 1-144 sort_ext$rec_ptr_b external static pointer dcl 1-147 sort_ext$release_count external static fixed bin(30,0) dcl 1-150 sort_ext$report_sw external static bit(2) unaligned dcl 1-153 sort_ext$return_count external static fixed bin(30,0) dcl 1-156 sort_ext$rev external static fixed bin(1,0) array dcl 1-159 sort_ext$sort_compare_exit external static entry variable dcl 1-168 sort_ext$sort_desc_pn external static char(168) unaligned dcl 1-170 sort_ext$sort_input_record_exit external static entry variable dcl 1-173 sort_ext$sort_output_record_exit external static entry variable dcl 1-178 sort_ext$srp external static pointer dcl 1-183 sort_ext$ssp external static pointer dcl 1-189 sort_ext$time_info external static structure array level 1 unaligned dcl 1-198 sort_ext$w external static fixed bin(30,0) array dcl 1-218 sort_ext$write_count external static fixed bin(30,0) dcl 1-230 sort_input_record_exit defined entry variable dcl 1-175 sort_output_record_exit defined entry variable dcl 1-180 srp defined pointer dcl 1-184 ssp defined pointer dcl 1-190 time_info defined structure array level 1 unaligned dcl 1-203 w defined fixed bin(30,0) array dcl 1-219 write_count defined fixed bin(30,0) dcl 1-231 NAMES DECLARED BY EXPLICIT CONTEXT. common_start 000270 constant label dcl 95 set ref 129 compute_string_size 001145 constant entry internal dcl 206 ref 202 exit 000377 constant label dcl 112 get_wf_dir_name 000554 constant entry internal dcl 148 ref 110 initialize_presort 001112 constant entry internal dcl 192 ref 101 initiate 000170 constant entry external dcl 22 initiate_private 000422 constant entry external dcl 119 state_test 000455 constant entry internal dcl 132 ref 80 THERE WERE NO NAMES DECLARED BY CONTEXT OR IMPLICATION. STORAGE REQUIREMENTS FOR THIS PROGRAM. Object Text Link Symbol Defs Static Start 0 0 2056 2164 1507 2066 Length 2446 1507 106 246 346 0 BLOCK NAME STACK SIZE TYPE WHY NONQUICK/WHO SHARES STACK FRAME initiate 350 external procedure is an external procedure. state_test internal procedure shares stack frame of external procedure initiate. get_wf_dir_name internal procedure shares stack frame of external procedure initiate. initialize_presort internal procedure shares stack frame of external procedure initiate. compute_string_size internal procedure shares stack frame of external procedure initiate. STORAGE FOR AUTOMATIC VARIABLES. STACK FRAME LOC IDENTIFIER BLOCK NAME initiate 000100 file_size_temp initiate 000102 merge_order initiate 000103 string_size initiate 000104 state_code initiate 000105 arg_err_sw initiate 000106 expand_path_code initiate 000110 shortinfo initiate 000112 longinfo initiate 000144 keys_ptr_pass initiate 000146 exits_ptr_pass initiate 000150 user_out_sw_pass initiate 000160 s_m_init_code initiate 000212 number_64k_segs compute_string_size 000213 number_255k_segs compute_string_size THE FOLLOWING EXTERNAL OPERATORS ARE USED BY THIS PROGRAM. r_l_a alloc_cs cat_realloc_cs call_ext_out_desc call_ext_out return fl2_to_fx1 fl2_to_fx2 mpfx2 shorten_stack ext_entry_desc trunc_fx2 ceil_fl real_to_real_rd divide_fx3 dsqrt THE FOLLOWING EXTERNAL ENTRIES ARE CALLED BY THIS PROGRAM. convert_status_code_ decimal_exp_ expand_path_ get_pdir_ get_wdir_ ioa_$ioa_stream sort_merge_initiate unique_chars_ THE FOLLOWING EXTERNAL VARIABLES ARE USED BY THIS PROGRAM. error_table_$bad_arg error_table_$out_of_sequence error_table_$pathlong sort_ext$debug_sw sort_ext$disaster2 sort_ext$max1 sort_ext$max2 sort_ext$max3 sort_ext$max4 sort_ext$mii sort_ext$old_input_file_num sort_ext$sii sort_ext$sip sort_ext$ssi sort_ext$state sort_ext$terminate_print_sw sort_ext$time_sw sort_ext$unique_prefix sort_ext$user_out_sw sort_ext$wf_dir_name sort_ext$wf_full_name sort_ext$whoami sys_info$max_seg_size LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC LINE LOC 22 000162 80 000210 81 000212 82 000214 83 000220 85 000221 86 000224 87 000240 88 000255 89 000261 90 000262 91 000263 92 000265 93 000266 95 000270 97 000272 98 000331 99 000332 101 000335 103 000336 104 000342 105 000345 106 000352 107 000353 110 000376 112 000377 114 000403 115 000412 119 000413 125 000442 126 000445 127 000447 128 000452 129 000454 132 000455 134 000457 137 000476 138 000540 139 000545 140 000547 142 000550 143 000552 145 000553 148 000554 150 000555 153 000600 154 000607 156 000610 159 000624 160 000633 165 000634 167 000663 173 000665 174 000700 177 000743 178 000745 181 000746 182 001016 184 001034 185 001046 188 001107 190 001111 192 001112 194 001113 195 001115 196 001116 197 001120 198 001121 199 001122 200 001134 201 001141 202 001143 203 001144 206 001145 210 001146 211 001205 214 001230 215 001245 217 001250 218 001253 219 001256 222 001264 223 001266 224 001270 225 001271 226 001274 228 001276 229 001277 230 001303 231 001305 232 001311 233 001313 237 001356 238 001357 239 001363 240 001373 241 001377 242 001401 246 001435 248 001436 249 001440 253 001471 ----------------------------------------------------------- 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