0 votes
by (170 points)

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();

// 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 
Applies to: Rebex FTP/SSL

1 Answer

+1 vote
by (17.7k points)

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);


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

or only:

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

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

by (17.7k points)

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