The problem is that in DB2 for z/OS there are some limit, such as:
Maximum number of tables in a FROM clause: 225
Maximum number of subqueries in a statement: 14
Longest SQL statement: 32767 bytes
Maximum number of elements in a select list: 750
Maximum number of predicates in a WHERE or HAVING clause: 750
Maximum total length of columns of a query operation
requiring a sort key (SELECT DISTINCT, ORDER BY,
GROUP BY, UNION without the ALL keyword, and the
DISTINCT column function): 4000 bytes
I hope this may be useful.