MIDRANGE dot COM Mailing List Archive



Home » MIDRANGE-L » November 2004

RE: Reordering a file



fixed

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


> From: Gary Monnier
> 
> I have to admit I haven't been too observant with this thread so
forgive
> me if I'm asking a silly question.  Why not use a user index rather
than
> a file?






Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2014 by MIDRANGE dot 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 here. If you have questions about this, please contact