0 votes
by (170 points)
edited

I'm trying to FTP to mainframe. But I got the following error message: "Name length error for pathname ftp://ps2.lac.com//'HRUNT.PER.EEF.DE34.ACK.DDATA(+1)' (550)."

What is the correct path name to use if I want to FTP to Mainframe?

Here is the code:

ftpHost = "ps2.lac.com";
ftpUserId = "testuser";
ftpPassword = "testpwd";
MainframeName = "HRUNT.PER.EEF.DE34.ACK.DDATA(+1)";

Ftp client = new Ftp();
client.Connect(ftpHost);

// authenticate 
client.Login(ftpUserId, ftpPassword);

// browse directories, transfer files 
client.Site("RECFM=FB LRECL=120 BLOCKSIZE=27900");

string ftpfullpath = String.Format("ftp://{0}//'{1}'", ftpHost, MainframeName);
client.PutFile(f, ftpfullpath);

// disconnect 
client.Disconnect();
Applies to: Rebex FTP/SSL

1 Answer

+1 vote
by (18.0k points)
edited

The remotePath parameter of the PutFile method is not expected to be in the full URI format (starting with "ftp://servername...").

Try to construct ftpfullpath just with the following value:

string ftpfullpath = String.Format("//'{0}'", MainframeName);

or:

string ftpfullpath = String.Format("//{0}", MainframeName);

or only:

string ftpfullpath = String.Format("{0}", MainframeName);
by (170 points)
edited

string ftpfullpath = String.Format("//{0}", MainframeName); works But the file sent as binary. How do I specify the file sent as text file?

by (18.0k points)
edited

The Ftp class default transfer mode is binary. To upload file in ASCII format try setting the TransferType property to FtpTransferType.Ascii first.

For an example see http://forum.rebex.net/questions/728/sending-file-in-ascii-format

...