PDA

View Full Version : Re: Carriage returns are stripped from text files.



recebov
26-Oct-2011, 15:06
This update (
www.novell.com/support/viewContent.do?externalId=7008378&sliceId=1 )
will not actually help in some cases. In my case I have an FTP client on
IBM z/OS which has EBCDIC encoded text files. Binary FTP upload of these
files to pure-ftpd on *nix will not be readable by any text editor or
viewer. Check out this link for more information: 'TDI Users:
WorkingWithZOS'
(http://www.tdi-users.org/twiki/bin/view/Integrator/WorkingWithZOS)

The solution in my case was to use pure-ftpd's upload-script feature
and dos2unix utility which converts text file line endings between CRLF
and LF. Here is what I did on my Debian server:

- Enable pure-ftpd's upload-script feature:
echo "yes" > /etc/pure-ftpd/conf/CallUploadScript

- Add option UPLOADSCRIPT in /etc/default/pure-ftpd-common:
UPLOADSCRIPT=/opt/bin/add-cr.sh

- "add-cr.sh" contains:
#!/bin/sh
/usr/bin/unix2dos -q -k "$1"


* unix2dos utility is included in dos2unix package and it adds
"carriage return" only to text files, binary files are not "touched" by
unix2dos.


Regards,
Samuel Recebov


--
recebov
------------------------------------------------------------------------
recebov's Profile: http://forums.novell.com/member.php?userid=118792
View this thread: http://forums.novell.com/showthread.php?t=343206

dpartrid
26-Oct-2011, 20:26
Samuel, you wrote:

>IBM z/OS which has EBCDIC encoded text files. Binary FTP upload of
these
>files to pure-ftpd on *nix will not be readable by any text editor or
viewer.

Possibly you have misunderstood what the update does or how it is
intended to be used. After setting "disable_ascii yes" on pure-ftpd,
you would still tell the IBM z/OS to do a ascii upload, so it would be
converting the file from EBCDIC to ASCII before sending it. It will not
be sending it in binary mode. However, the pure-ftpd side will receive
/ process it as if it was receiving a binary transfer, which means it
will not change it in any way. So the file will still be in ascii, not
the unreadable EBCDIC. The only difference between this "ascii
transfer" and a standard ascii transfer is that the line delimiters will
have carriage returns in addition to the line feeds.


--
dpartrid
------------------------------------------------------------------------
dpartrid's Profile: http://forums.novell.com/member.php?userid=18260
View this thread: http://forums.novell.com/showthread.php?t=343206