|
On Thu, 18 Nov 2004 15:45:02 -0600, Joe Pluta <joepluta@xxxxxxxxxxxxxxxxx> wrote: > 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. It seems that there are two steps to the problem. 1. Get the records into the order you want. 2. Update the sequence number with the RRN Step 1 seems straight-forward . . . INSERT INTO TJLIB/TESTSRC1 (SRCSEQ, SRCDAT, SRCDTA) SELECT * FROM tjlib/testsrc ORDER BY SRCDTA Step 2 is easy in RPG, but I can't get a SQL statement to work for the life of me. UPDATE TJLIB/TESTSRC1SET SRCSEQ = RRN(TESTSRC1) Fails with a "Conversion Error" -- Tom Jedrzejewicz tomjedrz@xxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.