zOs/SQL/CATFORKY

with r as (
select creator chCr, tbName chTb, relName rel,
       REFTBCREATor paCr, refTbName paTb, colCount cols
    from sysibm.sysRels
    where creator = 'OA1T' -- and tbName like 'TCT%'
)
, k (chCr, chTb, rel, paCr, paTb, cols, ixCr, ix, cK, kys) as
( select r.*, i.creator, i.name, 0, varchar('', 500)
    from r join sysibm.sysIndexes i
       on r.chCr = i.tbCreator and r.chTb = i.tbName
  union all select chCr, chTb, rel, paCr, paTb, cols, ixCr, ix, cK+1,
       kys || ' ' || strip(char(ck+1))
           || '>' || strip(char(j.colSeq))
           || '>' || strip(char(f.colname))
      from k join sysibm.sysforeignKeys f
          on k.chCr = f.creator and k.chTb=f.tbName and k.rel=f.relName
               and f.colSeq = cK+1 and cK < 9999
         join sysibm.sysKeys j
           on k.ixCr = j.ixCreator and k.ix = j.ixName
             and f.colName = j.colName and j.colSeq <= k.cols
)
select * from r where not exists
        (SELECT 1 from k
            where r.chCr = k.chCr and r.chTb = k.chTb
                  and r.rel = k.rel and k.cols = k.cK
        )
    order by chCr, chTb, rel