I don't see where you use a macro variable.
In any case, the message
ERROR: CLI describe error: [IBM][CLI Driver][DB2/AIX64] SQL0101N The statement was not processed because a limit such as a memory limit, an SQL limit, or a database limit was reached. SQLSTATE=54001
indicates that the statement is too long or too complex.
This is a DB2 limitation: Your SQL clause is too long or complex and DB2 rejects it. See https://www.ibm.com/docs/en/db2-for-zos/12?topic=codes-101
Talk to the DB2 DBA for recommendations.
As stated, the simplest work-around is to join to an uploaded table.
Another solution is to send a query smaller than the maximum allowed, and apply the rest of the tests in a subsequent phase.
... View more