× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Joe, its not a lot of elements, right?  Just load the records into an array,
then sorta.

 
      * Set the subfile for sorting - ascending & descending
     D                 ds
     D SflArrayUp                   850    dim(200)
     D  SortUp                       50    overlay(SflArrayUp)
     D  DataUp                      800    overlay(SflArrayUp:*next)
     D SflArrayDown                 850    dim(200) Descend
     D  SortDown                     50    overlay(SflArrayDown)
     D  DataDown                    800    overlay(SflArrayDown:*next)
That's how I did it to sort a subfile.  (DataUP) is a datastructure of the
actual data I want to display.  The SortUp field is for the fields I wish to
sort by. 
 
---------------------------------
Booth Martin
http://www.martinvt.com
---------------------------------
-------Original Message-------
 
From: Midrange Systems Technical Discussion
Date: 11/18/04 09:45:46
To: 'Midrange Systems Technical Discussion'
Subject: Reordering a file
 
Who can think of quick ways to sort a file on a NON-key field?
 
 
 
Quick background: I have a menu file (option, program, description) that
I wanted to appear in the menu by program name.  Quick way out in my
mind: sort the physical file by program, then use SQL to set the option
equal to the relative record number - and voila the menu is in
alphabetical sequence.
 
 
 
Other options come to mind.  I could have removed the option number from
the file entirely and kept the program IDs in an array (or even in the
subfile itself if I didn't use page at a time processing).  This would
give me a lot more flexibility in ordering the records. That might not
be acceptable in a large ERP package where a specific menu option is
expected to always mean the same thing.
 
 
 
However, the way I chose worked, except that I couldn't find an easy
(i.e., single step) way to sort the records in a file based on an
arbitrary sort sequence.  I could have created a logical and sorted by
the logical, then deleted the logical.  I took the route of creating a
second file in QTEMP using STRSQL and doing a SELECT * ORDER BY on the
file, copying the temporary file back into the original and then
deleting the temp file.
 
 
 
Any other suggestions?
 
 
 
Joe
 
 
 
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
 
 

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.