zOs/SQL/PVM7700S

select mon, arbid, sum(erstPag#), sum(erstCou#)
    from
        (select
                year(datum) * 100 + month(datum) as mon,
                left(erstJob,4) arbid,
                erstPag#,
                erstCou#
            from $DBOWNER.vpv013a1a
            where mandant = '0034'
                and left(erstJob,2)
                    in ('W0', 'W1', 'W2', 'W3', 'W4', 'W5')
                and datum between '${MONTH}01' and   '${MONTH}31'
        ) t1
    group by      arbid , mon
    order by      arbid desc, mon