|
Sorry for misreading the question, but given that, I would read through the file, loading an array. I would then sort the array, close the file, clear it, open it, and repopulate it from the array. --------------------------------- Booth Martin http://www.martinvt.com --------------------------------- -------Original Message------- From: Midrange Systems Technical Discussion Date: 11/18/04 15:28:56 To: 'Midrange Systems Technical Discussion' Subject: RE: Reordering a file I was not trying to get the various ways to order records from a file in an arbitrary sequence. There are many ways, and in fact nobody selected one of my all-time favorites, OPNQRYF. The point was that I wanted to update the file with a sequence number, and I was simply asking for the easiest way to do that. It's amazing how many people insist on answering the question I specifically did NOT ask <grin>. Thanks, though, folks! It's actually a pretty cool discussion. Unfortunately it doesn't answer my question. The question is more simply stated this way: Given any file with a sequence number field, what is the simplest method to update the sequence number field to number the records sequentially based on an arbitrary view for which there is no logical. So far, my way is the fewest steps: use STRSQL to sort the records into a temp file, then copy the temp file to the original. Paul suggested FMTDTA, but as far as I know that requires creating another source member with the sort criteria. Not impossible, but it's an additional step. Same with creating a logical view and using that to reorganize the file: one extra step. The only other suggestion so far that fits the stated business requirement is to add a constraint and then use that to reorganize the file. The only downside is that you can't add a primary key constraint to a keyed physical, and this file happens to be a keyed physical (one more reason not to have keyed physicals, I guess!). Joe
As an Amazon Associate we earn from qualifying purchases.
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.