FWiW: For more than just the effective INTERSECT of the names, the following shows that as well as the unmatched names betwixt; the specification of the qualified SYSCOLUMNS or similar catalog VIEW and the corresponding column names may be specific to the DB2 variant such that adjustments are likely required, but the following was successful, exactly as shown, using the IBM DB2 for i 7.1 SQL:
Setup:
create table bp.TABLE1 (in_both char, common char, only_in_t1 char )
;
create table bp.TABLE2 ( only_in_t2 char, in_both char, common char)
;
Query of the columns:
SELECT t1_col, t2_col
from ( select char( column_name, 25) as t1_col
from syscolumns
where table_name = 'TABLE1' and table_schema='BP' ) as t1
full outer join
( select char( column_name, 25) as t2_col
from syscolumns
where table_name = 'TABLE2' and table_schema='BP' ) as t2
on t1_col = t2_col
; -- report from above query, with headings, follows [where a dash indicates NULL value]:
T1_COL T2_COL
IN_BOTH IN_BOTH
COMMON COMMON
ONLY_IN_T1 -
- ONLY_IN_T2