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

Re: Sorting sequentil files



Since I don't know what database or operating system you're using, I'll
relate a similar problem I had writing a report with SQR on Oracle and
VMS:
I was given a file with SSN's and needed to output database information on
this set of people in ZIP order for bulk mailing purposes.  Since I had to
read the SSN's in 1 at a time and the zip info was coming from the database,
I had to do this in several steps...
  1) read in each SSN and get address info(and name, etc..) for each person.
        I wrote this information out to another flat file.
  2) do *an operating system sort on this file*(VMS sorts are blistering
        fast).
  3) read back in the sorted file and write the report(actually letters) for
        each person.

Here's the two line call I used for the VMS sort:

   LET $system-call = 'SORT ' || $outfilename || ' ' || $outfilename
   CALL SYSTEM USING $system-call #call-status

Note that you have to build the command before issuing the call command.
Both UNIX and DOS have operating system level sorts that could probably
be used in a similar fashion.

Tim Harris
Systems Analyst
Oregon State University
harrist@ccmail.orst.edu

On Wed, 12 Jun 1996, Bill Spence wrote:

>      I have a report requirement which must be sorted by a
>      calculated value base on the input records from the
>      database.
>      I read the data from the database,calculate the value and
>      write it to a file. Is there any method for sorting the file
>      or any third party software available.
>