Problem:
You can use the WinHTTP COM objects in Windows to issue HTTP Request from a COBOL Application.
How can you specify timeout values for the HTTP Request ?
Resolution:
WinHTTP has a "setTimout" method that allows you to specify :-
ResolveTimeout
ConnectTimeout
SendTimeout
ReceiveTimeout
To call this from COBOL you would first need to set the OLE Dispatch type as the method name starts with "set" so by default COBOL would attempt a property fetch.
The code on COBOL you need to issue would be:-
invoke olesup "setDispatchType" using by value 0
******* The next line would force a timeout
* invoke ws-winhttp "setTimeouts" using by value 500 500 500 500
******* We can set to something more reasonable for the target server
invoke ws-winhttp "setTimeouts" using by value 0
60000
60000
60000
Attached is a working sample.



