Don't know which version of i5/OS you are on. This is from V5R4 documentation. But things you may be coming across:
1 - The total number of subselects in a fullselect (UNION or UNION ALL clause) is greater than 32.
2 - The total number of columns, constants, and operators is greater than the SQL limits.
3 - The sum of the lengths of the non-LOB columns in a select list, table, view definition, or user defined table function is greater than 32766 or the definition contains a LOB and the sum of the lengths specified on the ALLOCATE clause for varying-length fields and the non-varying field lengths is greater than 32740. The maximum length is reduced if any of the columns are varying-length or allow null values.
4 - The total number of nested subselects is greater than 31.
5 - The total length of the statement text is greater than 65535.
6 - The relative position value specified on the FETCH statement is outside the range of valid values.
7 - A system name could not be generated.
IBM's recommendation is to break up the SQL, on which case Petter as a pretty good idea. Otherwise you may have to query more than once and marry the results later.