Hi,
I would first make sure that the parts which don't execute would work in a small script using ODBC:
Why not, just set tracing on in your sqlca.dbms parameter by preceding it with "TRACE ODBC" or "TRA ODBC". The output will then give you more clarity about why some of the commands did not run and if indeed it's a size problem.
ODBC is a lot more limited than any native driver, especially when it comes to 'execute dynamic' commands.
Once you are sure that indeed it's to do with the size of the script, you could split the script into several ones instead of one big one. (but I don't think that's really the problem here).
regards.