Win32, FTP, line ends

P

Phil Hibbs

I'm using Net::FTP on ActiveState perl 5.8.0 and I'm having a problem
with line ends.

The source files are MS-style with CR/LF line ends, and I'm FTPing the
file to an MVS mainframe (EBCDIC). The files received at the other end
still have the CR x'0D' character at the end.

I have worked around the problem by making a temp copy of the file and
converting the line ends to Unix-style and then FTPing that file, but
how can I get Net::FTP to behave as though the local platform were
Microsoft (which it is)? It's behaving like a *nix FTP client.

Phil Hibbs
http://www.perlmonks.org/index.pl?node=PhilHibbs
 
S

Sherm Pendley

Phil said:
I'm using Net::FTP on ActiveState perl 5.8.0 and I'm having a problem
with line ends.

If you want automagic EOL translation, you need to enable ASCII mode - see
the description of the ascii() method in Net::FTP's docs.
how can I get Net::FTP to behave as though the local platform were
Microsoft (which it is)? It's behaving like a *nix FTP client.

If I recall correctly, binary/ASCII mode FTP dates from long before UNIX and
DOS/Windows were predominant. Its original purpose was to transfer text
files between EBCDIC and ASCII based machines - although obviously it did
quite a bit more than just munge EOL characters in that case.

In other words, Net::FTP isn't behaving like a *nix client, it's behaving
like any standard client that's set to default to binary transfers.

sherm--
 
P

Phil Hibbs

Sherm Pendley said:
If you want automagic EOL translation, you need to enable ASCII mode - see
the description of the ascii() method in Net::FTP's docs.

I am, because I'm sending the files to an IBM mainframe, and they need
to be translated to EBCDIC.

Phil Hibbs.
 
S

Sherif Zaroubi

I'm using Net::FTP on ActiveState perl 5.8.0 and I'm having a problem
with line ends.

The source files are MS-style with CR/LF line ends, and I'm FTPing the
file to an MVS mainframe (EBCDIC). The files received at the other end
still have the CR x'0D' character at the end.

I have worked around the problem by making a temp copy of the file and
converting the line ends to Unix-style and then FTPing that file, but
how can I get Net::FTP to behave as though the local platform were
Microsoft (which it is)? It's behaving like a *nix FTP client.

Phil Hibbs
http://www.perlmonks.org/index.pl?node=PhilHibbs


Is there a way to do the transpher as text mode and not binary mode?
 
P

Phil Hibbs

l v said:
Try ftping the file via the dos ftp command. If the mainframe file
still contains x'0D' at the end, then the mainframes ftp ebcdic to ascii
translation tables need to be changed.

Yes, Windows' built-in ftp command handles the line ends correctly.

Phil Hibbs.
 
J

Jussi Jumppanen

Phil said:
I am, because I'm sending the files to an IBM mainframe, and they need
to be translated to EBCDIC.

Take a look at the Zeus for Windows editor:

http://www.zeusedit.com/lookmain.html

it has integrated FTP editing and supports unix, windows, MVS
and VM FTP servers.

Jussi Jumppanen
Author of: Zeus for Windows (All new version 3.92 out now)
"The C/C++, Cobol, Java, HTML, Python, PHP, Perl programmer's editor"
Home Page: http://www.zeusedit.com
 
P

Phil Hibbs

Jussi Jumppanen said:
Take a look at the Zeus for Windows editor:

Thanks, I'll take a look, I'm always on the lookout for a good text
editior. I can't use it for this purpose, as the script needs to send
hundreds of files, and gets the list of files from a text config file.

Phil Hibbs.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,138
Messages
2,570,804
Members
47,349
Latest member
jojonoy597

Latest Threads

Top