Page 1 of 1

FTP VB file from tape to Unix - RDW is dropped

PostPosted: Thu Nov 03, 2011 12:02 am
by sinksort
We have a problem FTP'ing VB files that are on tape - the RDW is being dropped. When the dataset is on disk, the RDW is preserved and there are no issues. Do you know what would cause this to happen? The FTP syntax is below...

//S030     EXEC PGM=FTP,PARM='(EXIT'
//INPUT    DD *
cd /test/file
SITE UMASK 022
BINARY
LOCSITE RDW
PUT //DD:TAPEDSN  test_file_from_tape.DAT
quit
/*
//TAPEDSN  DD  DSN=VARIABLE.BLOCK.FILE.ON.TAPE
//             DISP=SHR,
//             UNIT=TAPE
//OUTPUT   DD  SYSOUT=*,
//             AVGREC=K,
//             RECFM=FB,LRECL=160,BLKSIZE=160
//         INCLUDE MEMBER=SYSOUT
//*

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Thu Nov 03, 2011 12:27 am
by steve-myers
For better or worse, FTP is operating as designed. Yhe RDW is not sent in a binary transfer.

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Thu Nov 03, 2011 1:14 am
by steve-myers
U was called away while writing my previous post. To continue:

A Unix file is just a stream of bytes. It has no attributes like record format and logical record length as is true of datasets in z/OS. There are no records as we understand them in OS/360 type datasets, so FTP just sends the stream of bytes in a binary transfer. An RDW in a RECFM=VB dataset is non-data control information so it is not sent. RECFM=FB datasets can be reconstructed in Unix because the records are fixed in length, but this is not true of RECFM=VB datasets. You can send RECFM=VB datasets to Unix as a text file because FTP will insert a newline character at the end of each logical record, and FTP will translate text data from EBCDIC to ASCII, but this translation is not always very consistent for non-text data, or for text data like the left and right square brackets that do not have a consistent EBCDIC definition.

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Thu Nov 03, 2011 6:08 am
by Robert Sample
When the dataset is on disk, the RDW is preserved and there are no issues.
If you are using the same FTP parameters, then the RDW would not be preserved. Binary FTP transfers of files with variable length files are going to lose the RDW (no matter if the source is tape or disk) as the RDW is not considered part of the record. Without doing some kind of special action, as far as I know it is not possible to successfully transfer using binary a file with variable length records to a Unix system and retain the record structure.

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Thu Nov 03, 2011 9:35 am
by steve-myers
Robert Sample wrote:... it is not possible to successfully transfer using binary a file with variable length records to a Unix system and retain the record structure.
The same is true of datasets with "undefined" records such as load module members.

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Fri Nov 04, 2011 3:08 pm
by prino
Gentlemen,

RDW can apparently be sent!

See File Transfer Protocol (FTP) - A List of FTP Commands

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Fri Nov 04, 2011 3:37 pm
by BillyBoyo
Good hunting, Prino.

Needs to be checked upon. Rest of the page seems to talk only of Unix and Windows. May have been pasted uncredited from elsewhere.

The BDW preceding the RDW on occasion is a little trip-up waiting to happen. Would need some work to handle.

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Fri Nov 04, 2011 3:46 pm
by MrSpock
prino wrote:Gentlemen,

RDW can apparently be sent!

See File Transfer Protocol (FTP) - A List of FTP Commands


IF mode is STREAM and transfer type is IMAGE (binary).

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Fri Nov 04, 2011 4:41 pm
by prino
MrSpock wrote:
prino wrote:Gentlemen,

RDW can apparently be sent!

See File Transfer Protocol (FTP) - A List of FTP Commands


IF mode is STREAM and transfer type is IMAGE (binary).

Also for ASCII, but in this case you may not get what you want:

z/OS:
----+----1----+----2----+----3----
{Z-NL  +00 D   +00 DK  +00 S   +00

Windoze:
----v----1----v----2----v----3----v---
.↨..{Z-NL  +00 D   +00 DK  +00 S   +00
01007524422233242222332442223325222233
0700BADEC00B0004000B0004B00B0003000B00

And the 0017 is a EBCDIC-ASCII translation of x'26', aka 38. In other words, the RDW is sent, includes the length of itself, but it's also translated to ASCII...

Re: FTP VB file from tape to Unix - RDW is dropped

PostPosted: Fri Nov 04, 2011 5:16 pm
by BillyBoyo
Well, that is useful on a scale of zero to zero. Translate it back before using it...

I guess for the BDW it is not really a problem as I assume you get the whole block at once. Then convert it from ASCII....

However, it is always pointless doing both a BINARY transfer and a character-set translation, isn't it?