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!).


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

This thread ...


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