[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index] [Date Index] [Thread Index]
[SQR-USERS Info] [SQRUG Home Page]

Re: How to sort file contents ?



If you are reading in a flat file the following may help.

Using the "Call System" command in SQR you can execute system sorts(UNIX,
DOS, ETC.)

Below is an example of a sort I have used in UNIX.

Let $sort_order = 'sort -n +1 -b -n +3 -r -b data-filein.dat
{Anydirectory}p-250.dat -o {Anydirectory}data-fileout.dat'
Call System Using $sort_order #status

if #status <> 0
show ' Error executing Sort command ' #status
else
show 'Sort Complete Successfully '
end-if

For tables you can use the "order by" option on the "Begin-Select"
statement.

Chester J. Craig
cjcraig@sprynet.com
-----Original Message-----
From: TUHINAROY <TUHINAROY@INF.COM>
To: Multiple recipients of list SQR-USERS <SQR-USERS@list.iex.net>
Date: Friday, April 03, 1998 7:44 AM
Subject: How to sort file contents ?


>     Hi,
>
>     I need to read a file and sort its contents based on one of the fields
and
>     print them. I dont think there's any command in SQR which would help
me do
>     this(like we have internal sort in Cobol). Can anyone tell me how it
can be
>     done?
>
>     TIA
>     Tuhina.