WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

WinInet
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Ftp Functions and OpenVms

 Keywords: iFtpPut FTp OpenVMS VMS WinInet

Question:

Afternoon. we have been upgrading our work stations to Vista. On one of these workstations we have a script that the user runs to ftp a .CSV to the mainframe, which is an DEC ALPHA OPEN VMS System.

Here is a snip:

AddExtender("WWINT44I.DLL")
AddExtender("WWWSK44I.DLL")
x=iFtpPut(conhandle,"OK_FOODS.CSV","ZME:OK_FILE.CSV",0,@BINARY,@TRUE)
Now when I use the above code the file will upload. but can not be read. if I use the following code:
x=iFtpPut(conhandle,"OK_FOODS.CSV","ZME:OK_FILE.CSV",0,@ASCII,@TRUE)
the connection will timeout and nothing is uploaded. This script was working with XP PRO but not under VISTA.

Answer:

I am concerned that the issue is due to the fact you are running the Open VMS server. http://support.microsoft.com/kb/172712

Microsoft makes it pretty clear that Wininet can have issues with this type of FTP server:

WinInet may have problems with some FTP servers. The FTP protocol is designed with the presumption that the output is viewed and viewed by a user, who can interpret 
the reply code and text. WinInet FTP attempts to parse and interpret the reply; if a server returns a nonstandard reply to the WinInet client, WinInet may not be 
able to function properly. 

In addition, some servers may require a sequence of commands which is incompatible with WinInet. For instance some servers require an account command be entered immediately upon logging on. Although you could enter an ACCOUNT command using the FtpCommand function after you have already logged on, the FTP logon sequence implemented by WinInet is not flexible enough to enter an ACCOUNT command if required immediately by the server.

The following is a couple of instances where problems are known to occur. This list is not exhaustive, and developers may encounter additional limitations not listed here.

VMS FTP servers: WinInet FTP functions may not work with some FTP servers running on the VMS operating system. In particular, the FTP functions may fail with an error, or the data structure that returns file information may be blank or contain invalid data.

For additional information, please see the following article in the Microsoft Knowledge Base: 168492 (http://support.microsoft.com/kb/168492/EN-US/ )

PRB: FTP WinInet APIs Report Error 12003
This problem occurs when text returned by the FTP server is in a format that WinInet cannot parse correctly. You can work around this problem by using the FtpCommand function and sending a LIST command to the server. You could then either display the listing results in your application directly or parse the returned data yourself.

You might be better off using the WinSock FtpPut functionality....Because of the known issues with WiniNet and VMS servers, I suggest using the WinSock FTPPut function to transfer this file to you OpenVMs FTP server. The Winsock test code would look something like:
DebugTrace(@ON, 'trace-winsock.txt')
AddExtender("WWWSK44I.DLL")
localfile = "D:\OK_FOODS.CSV" ;!!! Modify to fit your needs !!!!
remotefile = "ZME:OK_FILE.CSV";!!! Modify to fit your needs !!!!
host = "www.domain.com"         ;!!! Modify to fit your needs !!!!
user =   = ""                  ;!!! Modify to fit your needs !!!!
password = ""                  ;!!! Modify to fit your needs !!!!
acct = ""                     ;!!! Modify to fit your needs !!!!

; Check if local file exists
result = FileExist( localfile )
If result == @FALSE
   Pause( "Notice!", "Local file doesn exist" )
   Exit
EndIf

hSession=ftpOpen(host,user,password,acct,1)
If !IsNumber(hSession)
   Message("FTP Open Error",hSession)
   Exit
EndIf

rs=ftpPut(hSession, localfile, remotefile, "A")
If rs != ""
   Message("ftpPut Error", rs )
EndIf
ftpClose(hSession)
Exit

More Info...

If you are able to contact the system admin who is responsible for maintaining that OpenVMS system, they might be able to modify the FTP server to respond with more Unix-like messages.
Article ID:   W17614
Filename:   Ftp Functions and OpenVms.txt
File Created: 2017:07:28:13:58:45
Last Updated: 2008:12:15:08:04:35