parm link_input="?", link_multi="?", out_file = "?" if "!link_input" = "?" or "!link_multi" = "?" or "!out_file" = "?" then echo Usage: multilnk unique_file multi_file output_file echo echo This command file does many-to-many links echo with Suprtool Self-Describing files echo This generic link is done by the primary sort key. echo echo The unique_file must have unique keys. echo The multi_file may have duplicate keys. echo The output_file must not exist. echo escape 0 endif comment comment Check existence of input files comment if not finfo("!link_input","Exists") then echo Sorry, I can't seem to access !link_input. escape endif if not finfo("!link_multi","Exists") then echo Sorry, I can't seem to access !link_multi. escape 52 endif if finfo("!out_file","Exists") then echo Sorry, !out_file exists already. Please purge it or choose another name. escape endif comment comment Make sure that files are self-describing comment if not finfo("!link_input","FILE CODE") = 1084 then echo Sorry, !link_input is not a Self-Describing file. escape 52 endif if not finfo("!link_multi","FILE CODE") = 1084 then echo Sorry, !link_multi is not a Self-Describing file. escape 52 endif comment comment If run from a process that can suspend child-processes, comment then Great! (Like Qedit) comment comment We use parm=8 to tell suprtool to invoke the use string comment upon every activation. comment purge mtomone > $null purge mtomone,temp > $null purge mtomout > $null purge mtomout,temp > $null comment comment Number of records in output file will be max link1 * link2 comment setvar unique_eof finfo("!link_input","eof") echo I will have to do !unique_eof passes to multi-link the files. setvar rec_total unique_eof * finfo("!link_multi","eof") purge !out_file > $null purge !out_file,temp > $null file !out_file;disc=!rec_total comment echo input !link_input > supruse echo output mtomone,link,temp >> supruse echo xeq >> supruse echo set interactive off >> supruse echo exit >> supruse purge multilog > $null purge multilog,temp > $null run suprtool.pub.robelle;parm=40;info="use supruse" >> multilog comment comment Here's the loop comment setvar rec_end finfo("!link_input","eof") setvar rec_nbr 0 setvar append_flag "" comment comment The second part of the use file is static; comment create it only once. echo set interactive off > supruse2 echo output mtomone,link,erase >>supruse2 echo xeq >>supruse2 echo :purge mtomout > $null >>supruse2 echo :purge mtomout,temp > $null >>supruse2 echo :setjcw cierror 0 >>supruse2 echo link input !link_multi >>supruse2 echo link link mtomone >>supruse2 echo link output mtomout,temp >>supruse2 echo link xeq >>supruse2 echo input mtomout >>supruse2 echo output !out_file > supruse3 echo set squeeze off >>supruse4 echo xeq >>supruse4 echo exit >>supruse4 while rec_nbr < rec_end do setjcw cierror 0 echo input !link_input(!rec_nbr/!rec_nbr) > supruse1 run suprtool.pub.robelle;info= & "use supruse1;use supruse2;use supruse3;use supruse4"; & parm=40; >> multilog if cierror <> 0 then echo Suprtool encountered a serious error. See multilog. escape 42 endif if !rec_nbr = 0 then echo output !out_file,append > supruse3 endif setvar rec_nbr rec_nbr + 1 setvar percent_done (rec_nbr * 100) / unique_eof echo !percent_done% complete. endwhile setvar multi_eof finfo("!out_file","eof") echo The output file, !out_file, contains !multi_eof entries. comment comment This step sorts the final file comment echo i !out_file > linkfin echo o=input >> linkfin echo e >> linkfin setjcw cierror 0 continue run suprtool.pub.robelle;parm=36;info="u linkfin" >> multilog if cierror <> 0 then echo Suprtool encountered a serious error. Please see multilog. escape endif