For reference, these are what you'll be looking for in your od output:

CRLF - Carriage Return Line Feed (ASCII x'0D0A', escape sequence '\n'). Used on 
Windows (DOS) platforms.
CR    - Carriage Return (ASCII x'0D', escape sequence '\r'). Early Mac, before 
it became Unix based.
LF     - Line Feed (ASCII x'0A', EBCDIC x'25'). Unix and Unix-like systems 
(Linux, AIX, Mac OS X+).
NL    - New Line or Next Line (EBCDIC x'15'). EBCDIC systems (IBM mainframe, 
i5/OS).

I'd be guessing the file in Unix has x'0D0A' at the end, then when it gets to 
Linux it just has x'0A'.

I believe the z/OS FTP client is expecting the data to end with x'0D0A' to 
bring it in correctly. I would recommend running a utility on the Linux side to 
change the data to the way it should be. Look at the dos2unix and unix2dos 
utilities. Or try sed with somethink like one of these:
sed  s/.$//   <infile>   >   <outfile>
sed  s/$/\\x0d/   <infile>   >   <outfile>

Good reference: http://homepage.smc.edu/morgan_david/CS41/lineterminators.htm

Other than that you'd have to look at the man pages for the sftp software you 
are using between Linux and Unix to see if there is something you can specify 
to make it  do a binary transfer.

You don't want to do a binary transfer from Linux to z/OS, or else you'll still 
have to translate the data on z/OS and strip out the end-of-line characters. Of 
course, it has lots of options for that. We do some transfers where we do 
binary FTP them to z/OS and then use the iconv and Unix System Services cp 
command to translate them and transform the end-of-line characters.


-----Original Message-----
From: Linux on 390 Port [mailto:[EMAIL PROTECTED] On Behalf Of Edmund R. 
MacKenty
Sent: Wednesday, July 09, 2008 1:02 PM
To: LINUX-390@VM.MARIST.EDU
Subject: Re: SFTP versus FTP

On Wednesday 09 July 2008 13:00, Szwed, Tomasz A CIV USMEPCOM wrote:
> I have a file on Unix server.  When I transfer that file from Unix to
>Linux using FTP - I'm getting file with the same size.
>When I use SFTP, I'm getting file smaller by 79 bytes.  The file has 79
>lines.
>That file is then FTP from Linux to z/OS - using FTP batch job on z/OS
>(using "get" command).
>The file which was FTP-ed (from Unix to Linux) can be read on z/OS, the
>file which was SFTP-ed (from Unix to Linux) shows only first line.
>When I used "set list" command (vi editor on Linux) - I can see "$"
>(end of line character) on both files (in the same column).
>
>1.  How can I find out which character is lost during SFTP process?
>(I'm assuming that some control character is lost).  How can I get that
>file  using SFTP without losing any characters?

You can use the od (octal dump) command on UNIX or Linux to look at the values 
of each byte in the file.  Use the -c option to output printable ASCII 
characters as themselves, carriage-return and newline as "\r" and "\n", and 
other control characters as octal values.  For example:
        od -c myfile | less

>2.  Any other suggestion how to go around the problem? - I have to use
>the file which was SFTP-ed from Unix to Linux on z/OS (I cannot use the
>FTP-ed file).

Transfer the file in BINARY mode instead of ASCII.  Use the "bin" command in 
your FTP client to do that.
        - MacK.
-----
Edmund R. MacKenty
Software Architect
Rocket Software, Inc.
Newton, MA USA

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions, send email to 
[EMAIL PROTECTED] with the message: INFO LINUX-390 or visit 
http://www.marist.edu/htbin/wlvindex?LINUX-390

----------------------------------------------------------------------
For LINUX-390 subscribe / signoff / archive access instructions,
send email to [EMAIL PROTECTED] with the message: INFO LINUX-390 or visit
http://www.marist.edu/htbin/wlvindex?LINUX-390

Reply via email to