zOs/SQL/HAERDI

select count(*), ndep
    from oa1t.twm005a1
    group by ndep
    order by 1 desc
    with ur
;
x
select count(*), nDep
    from oa1t.twm005a1
 -- where cTyp = 'VEVA'
    group by nTyp, twmd1
    order by 1 desc
    ;