Frank Swarbrick
6/30/2006 2:43:00 AM
dkmd_nielsen@hotmail.com wrote:
> OK. Here is the straight dope. I'm not the only one with the
> mainframe/pc-network disconnect. FTP has the same disconnect. WHEN I
> run FTP from the mainframe and get the data from network, everything is
> ok. OS/390 TCP/IP understands all the CR/LF stuff and deals with it
> properly.
>
> On the other side is FTP on the network. This is mainly Unix based.
> (We all know that DOS is just a dumbed down Unix variant.) It operates
> in a LF or CR/LF world. When it is talking to the mainframe, it
> doesn't know that. Sure, I setup the ASCII/EBCDIC notification (TYPE
> A), but it still doesn't deal with the trailing characters.
>
> I really only have two alternatives here: 1) live with the extra byte
> on the mainframe side, or 2) live without the CR/LF on the network
> side. 1) is not a possibility. So 2) will have to be it. Since the
> data created on the PC side is extracted from an Excel spreadsheet, I
> have the data in a usable format. So the text file is not for general
> use.
>
> I hope someone else can make use of this information, or correct me
> where I am wrong.
>
> Have a good one, all!
I've worked a lot with transfering text files to and from a VSE
mainframe. I imagine an os/390 (z/OS) mainframe is quite similar.
Let's look at how this works.
(All of the below refers to ASCII text mode, not binary mode.)
First of all, FTP is an ASCII based protocol when transmitting text.
Secondly, no matter the source (Unix, PC, mainframe or whatever), the
end-of-line delimiter *IS* CR/LF. When a Unix machine transmits a file,
even to another Unix machine, it ads an LF after ever CR delimited line.
When receiving a text file it strips out the LF before storing the
file to the file system.
Mainframe is similar, somewhat. When sending a file in ASCII text mode
the mainframe FTP client or server does the following:
- Reads the record from the mainframe file
- Translates the record from EBCDIC to ASCII
- Appends an ASCII CR/LF
- Transmits the line (or ads it to a buffer to be transmitted when it's
full)
Receiving is similar:
- Receive a block of data
- Search for CR/LF
- When found, translate all data leading up to it from ASCII to EBCDIC
- Write the record to the file and throw away the CR/LF
Now I'm sure z/OS, like VSE, has quite a few options. One option is to
expect fixed length records with *no* delimiter. In this case the
mainframe (assuming a PC -> mainframe transfer) simply writes ever X
number of translated bytes as a record. But if the file actually *does*
have CR/LF delimiters then you end up writing those to the mainframe
file as well. You can recognise this fairly easy if the first two
characters of record two look like the EBCDIC equivalents of CR and LF.
I'm guessing this is your problem, but I can't be sure. Certainly there
must be someone at your site who is knowledgable about mainframe FTP and
all of its little quirks.
Good luck!
Frank