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



On 04-Dec-2013 19:10 -0800, Vinay Gavankar wrote:

I have 2 files, FILEA and FILEB, which have exactly same format,
about 20 fields each and the total length of the record is less than
200 bytes.

FILEB is a subset of FILEA.

What is the simplest way of getting a file with records in FILEA not
present in FILEB?

Working on a development box, so I am free to create temporary files
from these 2, as the number of records in these files is not very
high.

I may have to repeat this a few times so trying to figure the
simplest solution.

As UNION is a [row] set operation to combine rows, similarly the INTERSECT but to obtain matching rows, and the EXCEPT is another to show the difference.

<http://pic.dhe.ibm.com/infocenter/iseries/v7r1m0/topic/sqlp/rbafyexcept.htm>
IBM i 7.1 Information Center -> Database -> Programming -> SQL programming -> Data manipulation language -> Retrieving data using the SELECT statement

_Using the EXCEPT keyword_
"The EXCEPT keyword returns the result set of the first subselect minus any matching rows from the second subselect.
..."

So for example with the given assumptions, a similar scenario:

create table qtemp/filea (a char, d dec)
;
insert into qtemp/filea values
(1, 1), (2, 2), (3, 3), (4, 4), (5, 5)
;
create table qtemp/fileb (a char, d dec)
;
insert into qtemp/fileb values
(1, 1), (2, 2), (5, 5)
;
select * from qtemp/filea
EXCEPT
select * from qtemp/fileb
; -- effective report from above query follows:
....+....1
A D
3 3
4 4
**** end of data ****


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.