Hi,
To compare 2 tables I'd use the following SQL statement:
( Select * from Table1
Except
Select * from Table2)
Union
( Select * from Table2
Except
Select * from Table1)
If no rows are returned both tables are identical, that means all columns in
all rows are identical.
Mit freundlichen Grüßen / Best regards
Birgitta Hauser
"Shoot for the moon, even if you miss, you'll land among the stars." (Les
Brown)
"If you think education is expensive, try ignorance." (Derek Bok)
"What is worse than training your staff and losing them? Not training them
and keeping them!"
-----Ursprüngliche Nachricht-----
Von: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] Im Auftrag von CRPence
Gesendet: Tuesday, 10. February 2009 22:15
An: midrange-l@xxxxxxxxxxxx
Betreff: Re: PF data comparision
reach me wrote:
There are lots of fields in the physical files. It's basically
DSPOBJD reports on two different systems and I would like to
compare the source compilation and modified details of each
object. I got the data in two PF's and both are sitting now
in one system.
Perhaps the following [excusing errors in what field names are used
to represent the "source compilation" & "modified"; i.e. represented as
odcdat & odldat respectively, irrespective of existence or meaning of
those as field names]:
/* full outer join on the list [of objects] */
select a.odlbnm,a.odobnm,a.odobtp,a.odobat,a.odcdat,a.odldat
from ODfileA a -- data from system A
left outer join ODfileB b -- data from system B
using (odlibnm, odobnm, odobtp, odobat)
/* to include only mismatches, include the WHERE: */
where a.odcdat <> b.odcdat
or a.odldat <> b.odldat
union all
select b.odlbnm,b.odobnm,b.odobtp,b.odobat,b.odcdat,b.odldat
from ODfileB b -- data from system B
exception join ODfileA a -- data from system A
using (odlibnm, odobnm, odobtp, odobat)
/* to include only mismatches, include the WHERE: */
where a.odcdat <> b.odcdat
or a.odldat <> b.odldat
order by 1,2,3
Note: if /source change date/ is of interest, be aware that the ILE
program objects will not have that detail, which must come from the
modules instead.
Regards, Chuck
As an Amazon Associate we earn from qualifying purchases.