× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thanks everyone for your help.

The problem was with the transfer from Windows to Unix, which was being done
using winSCP, which did not strip out the '0d' even for ASCII mode. When it
was transferred using regular FTP in ASCII mode, everything was good.

On Thu, Mar 4, 2010 at 6:05 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>wrote:

Hi Vinay,

I don't know what the "default" is when going from Windows->Unix. That
would depend on the FTP client software that is used.

However, I can tell you the following:

a) The FTP standard for ASCII mode transfers (and only ASCII mode, not
binary, etc) is that each "line" of a text file must end in hex 0d 0a.
This *only* affects the format of the data while it's being transferred
over the network.

b) The standard for text files on Windows is also to end each line with
hex 0d 0a

c) The standard for Unix is to end each line of a file with just 0a.

Because of (a), above, A Unix FTP client will normally insert a 0d
character before each 0a character while it's transferring a file. If
the FTP server is also Unix, the server will strip these 0d characters
that come before 0a characters, returning the file back to it's original
format. Windows servers, and IBM i, do not strip the 0d because it's
normal for a file to contain these characters on those platforms.

So if they FTP from Windows -> Unix in ASCII mode, the Windows program
sends the file over the network as-is. The Unix box sees the 0d0a and
changes it to just 0a, which is the unix norm before the file is saved
to disk.

On the other hand, if they FTP Windows -> Unix in BINARY mode, no
translation is done. The file will be placed on the Unix box with the
0d characters still intact. (Not the norm for Unix) Simply looking at
the file on the Unix box should tell you if this is the case.

Assuming they did Unix->Windows with the 0d intact by mistake...

Now they FTP in ASCII mode from Unix -> IBM i. What happens? Well,
since the Unix box is NOT expecting lines to already be terminated with
0d0a (since that's not the Unix way), it'll automatically *add* a 0d
before each 0a. So while going over the network, the lines now end in
0d 0d 0a <-- two CRs before each LF.

When IBM i receives the network data, it strips the trailing 0d 0a
because it's putting the data into a PF, and a PF doesn't normally have
an end-of-line delimiter. So it strips the 0d 0a -- but because of the
earlier mishap, that still leaves an 0d behind.

I don't know if that's what's happening to you, but it's the first thing
that pops into my head that would cause the problem you're seeing...


On 3/4/2010 5:33 PM, Vinay Gavankar wrote:
Scott,

it is being sent to a PF, and I am suspecting that the 0d was already in
the
Unix file, which was due to botch up from transferring from Windows
server.
I did not know they were doing that transfer from Windows to Unix, I just
found it out. When transferring from Windows to Unix, what is the
default?
Do you have to specify ASCII transfer explicitly?

I have all these theories, ready to be investigated, but the person
sending
from the Unix server is still "absconding". So I can't try anything new.
:-(

On Thu, Mar 4, 2010 at 4:49 PM, Scott Klement
<midrange-l@xxxxxxxxxxxxxxxx>wrote:

Hi Vinay,

Are you FTPing to a PF or a STMF?

What you describe is the standard behavior when sending data in ASCII
mode to a STMF -- but I don't know why this would happen if you're
sending to a PF, unless the hex 0d was already in the Unix file (which
would be unusual on Unix -- but maybe it got transferred from a Windows
computer earlier without proper conversion)


On 3/4/2010 10:53 AM, Vinay Gavankar wrote:
Hi All,

One of our partners is FTPing data from a Unix FTP server to the AS400.
I
get a Hex '0D' at the end.

When the data being sent was matching in length (AS400 file record
length
was 368 characters and partner claimed that he was sending 368
characters),
the last character (which was a blank) was replaced by X'0D'. When he
sent
another file with varying data lengths (to a different AS400 file), on
the
AS400 I get the X'0D' was after the last character, followed by blanks.

I tried googling, and even though got a few hits with the same problem,
did
not find any solution.

TIA for any suggestions.

--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.