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

asked 13 Apr '11, 19:32

hhzhu's gravatar image

hhzhu
251
accept rate: 0%

edited 13 Apr '11, 20:23

Jan%20Sotola's gravatar image

Jan Sotola ♦♦
3566


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

answered 13 Apr '11, 20:43

Jan%20Sotola's gravatar image

Jan Sotola ♦♦
3566
accept rate: 36%

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

(14 Apr '11, 01:20) hhzhu
1

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

(14 Apr '11, 08:39) Jan Sotola ♦♦
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×152
×3

Asked: 13 Apr '11, 19:32

Seen: 863 times

Last updated: 14 Apr '11, 08:39