Any chance you could post the script here or maybe email it to me?
I work for CPWR and have lots of experience with the Winsock middleware. Just from your short desription I am wondering if this is the proper middleware to be using since you are communicating with 2 databases and a mainframe.
When you communicate with a mainframe all the communications are going to be in EBCDIC and are going to look like garbage. Also, there might be issues when commnicating with the DBs. Again, this might be the wrong middleware for this in the sense that it is at too low of a level.
I've worked with Winsock and EBCDIC, and had to use custom functions for parameterizing and executing the scripts. In my case, the reason I was getting timeouts was because either the authentication for the transaction was wrong, or the winsock send was wrongly parameterized.
Seeing the script you have would help a great deal...