! ! Sample program that demonstrates using the Unix sort command ! to sort a file from inside of an SQR program. ! begin-report do main end-report begin-procedure main ! ! Open the output file and write some data that is selected from a table ! open 'file1.dat' as 1 for-writing record=80:vary begin-select state name write 1 from &state:2 '|' &name:20 from customers end-select ! ! Close the file and call the Unix sort command ! To eliminate duplicate records, use sort -u. ! close 1 call system using 'sort file1.dat > file2.dat' #status ! ! Open the new file that was created and read it in. ! open 'file2.dat' as 1 for-reading record=80:vary while 1 read 1 into $string:80 if #end-file break end-if display $string end-while close 1 end-procedure