From past experience I know that the DB2 API is quite similar to the ODBC API.
The SQLAllocEnv function (which SQLAllocHandle probably calls when needing an environment handle) does little more than set up a small amount of memory for managing the environment in which connection information will be managed. Typically (assuming there are no bugs in the code) it only fails if you've run out of memory and can't malloc() sufficient memory.
None of that helps you, except to suggest that you monitor usage of memory in the process that is running the job. I think you're going to need to log a call with your support provider on this one.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.