mirror of
https://github.com/SEPPDROID/Digital-Research-Source-Code.git
synced 2025-10-25 17:34:06 +00:00
Upload
Digital Research
This commit is contained in:
38
MPM OPERATING SYSTEMS/MPM-86/MISC DRI DISKS/10/SORT.PLI
Normal file
38
MPM OPERATING SYSTEMS/MPM-86/MISC DRI DISKS/10/SORT.PLI
Normal file
@@ -0,0 +1,38 @@
|
||||
sort:
|
||||
proc options(main);
|
||||
dcl
|
||||
(input_file, output_file) file;
|
||||
open file (input_file) stream title ('b:x.lib');
|
||||
open file (output_file) stream output title ('b:y.lib');
|
||||
dcl
|
||||
b char (64) var,
|
||||
i fixed,
|
||||
switching bit,
|
||||
buff (250) char (64) var,
|
||||
bp fixed;
|
||||
on endfile(input_file)
|
||||
go to sort_buff;
|
||||
bp = 0;
|
||||
do while ('1'b);
|
||||
get file(input_file) edit(buff(bp+1))(a);
|
||||
bp = bp + 1;
|
||||
end;
|
||||
sort_buff:
|
||||
switching = '1'b;
|
||||
do while (switching);
|
||||
switching = '0'b;
|
||||
do i = 1 to bp - 1;
|
||||
if (buff(i) < buff(i + 1)) then
|
||||
do;
|
||||
switching = '1'b;
|
||||
b = buff(i);
|
||||
buff(i) = buff(i+1);
|
||||
buff(i+1) = b;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
do i = 1 to bp;
|
||||
put file(output_file) edit(buff(i),'')(a,skip,a);
|
||||
end;
|
||||
end sort;
|
||||
|
||||
Reference in New Issue
Block a user