× 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.



There is another SQL way - use STRQMQRY to run a QMQRY that has the statement SELECT DISTINCT * FROM etc and make the output be *OUTFILE and the outfile be the original file - very easy to make a command out of this, with file and library for parameters.

frank kolmann wrote:
Hi Jim

When I have exclusive access to a file and can do a CPYF *REPLACE
one method I use to drop duplicate records is create a temporary file
using
CREATE TABLE xxx LIKE yyy
INSERT into xxx (SELECT DISTINCT * from yyy WHERE etc)
DELETE FROM yyy
INSERT into yyy SELECT * from xxx

or replace the DELETE and INSERT with
CPYF xxx yyy MBROPT(*REPLACE)

This assumes you dont care which of the duplicates is removed.
If you need to remove a particular duplicate then this is not the way.
Regards
Frank Kolmann



Fri, 9 Jan 2009 10:50:21 -0600
from: "Jim Lowary"
subject: Using SQLRPGLE to find Dup Records and do Delete?

I have a program that is written in SQLRPGLE to find dup records in a
large file (below is the mainline and select routine). Can I get the
RRN of the record from the fetch of the SQL record? If so I can do a
delete that way.

I'd appreciate any help or suggestions (as I'm not much of an SQL >person
and have not played one on TV).
Thanks,
-- Jim Lowary

As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.