|
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 ****
--
Regards, Chuck
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
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.