Post by Mike Rayborn ***@comcast.net [H390-MVS]If we can, I'd like to focus on the binary file transfer for just a
bit. Many of you have stated that you like/want/need to preserve the
RDW in the records being transferred. And I understand why, since I'm
guessing you intend to post process the downloaded binary data and need
those RDW's so that you can processed the resulting file. Without those
RDW's you can't easily "see" where one record in the stream of bytes
begins and ends. Makes sense and I get it.
Yes, for a genuine binary VB file, the RDWs
are an integral part of the data. And even if
it is a text file, not a binary file, that is being
transferred in binary mode, for whatever
reason, then the text file will be trashed
if the RDWs are lost. That prevents the
text file from being transferred back up
to the mainframe (in either binary or
text mode).
Post by Mike Rayborn ***@comcast.net [H390-MVS]So I'd like to understand the expected processing for uploading (PUT) of
a binary file (let's say a GIF or JPG type file) to a recfm=vb dataset.
I personally consider it totally inappropriate
to be transferring a JPG to a RECFM=VB
dataset. That is *exactly* what RECFM=U
is for.
VB is for text files, like source code, or the
binary equivalent of that. Or genuine
binary variable-length data, such as SMF
records.
Post by Mike Rayborn ***@comcast.net [H390-MVS]As best I know, binary files on a PC don't have RDW's, so would you
expect an upload of a PC binary file to a recfm=vb style dataset to
succeed.
It is true that the RDW-format files you
see on the mainframe are almost
non-existent, but the concept of using
RDW files on the PC is perfectly valid.
There is nothing wrong with writing a
program to process an RDW-file. Note
that IBM themselves recognized the
need for an RDW-file, and they added
an "rdw" option for their ftp program
to preserver the RDW.
Even if you never actually process this
file on the PC, at least the data remains
intact so that you can transfer it to
another system and reupload it.
BTW, this is a really long debate we've
been having in the hercules-os380 group
(again!).
Post by Mike Rayborn ***@comcast.net [H390-MVS]The fwrite of the 256 bytes (x'00' - x'FF') returns
256 as expected. fwrite() rc=256
Ok, that looks like a bug in PDPCLIB, it
should have returned 0.
Post by Mike Rayborn ***@comcast.net [H390-MVS]However when I browse the dataset using RFE browse it looks like an
empty file. So I'm guessing the fwrite() interpreted the x'00010203' as
a RDW?
Correct. The length of x'0001' is an
error, and the '0203' is also an error,
so the error indicator is set and no
more writing is possible to the
dataset.
Post by Mike Rayborn ***@comcast.net [H390-MVS]So maybe this is a bug/feature of PDPCLIB or something I've
misunderstood in fwrite() behavior for binary files.
It's a feature of PDPCLIB. IBM C will
generate its own fixed-length RDW
to store inappropriate data in the VB
dataset.
When I was designing PDPCLIB, I
normally would have just copied IBM,
but when I realized that I couldn't do
a binary copy of a VB text file (or
perhaps a gzip and gunzip), because
all the RDWs got stripped, and thus
all the data ran together, ie a file like:
AAA
BBBB
got converted into a single line:
AAABBBB
irretrievably trashed, I wasn't willing to
code PDPCLIB to behave like that, as
I considered that it complicated MVS
datasets for someone moving from
Unix or MSDOS to the mainframe.
Post by Mike Rayborn ***@comcast.net [H390-MVS]My earlier email was a bit misleading as the GIF file I transferred to
the mainframe and back again was in fact to a RECFM=U dataset, and not a
RECFM=VB as I had claimed. So of course that worked as expected, as
RECFM=U was the correct dataset type for raw binary files like a GIF or
ZIP file.
Exactly correct.
It's actually very strange, in my opinion, to
expect VB files to behave the same as
RECFM=U. Surely there should be some
difference between these two formats, from
the point of view of a C program?
Post by Mike Rayborn ***@comcast.net [H390-MVS]So I've come around to thinking that binary transfers of the RDW style
RECFM=VB datasets should preserve and expect RDW byte sequence as the
first 4 bytes.
Cool!
Post by Mike Rayborn ***@comcast.net [H390-MVS]For ASCII transfers to a RECFM=VB dataset, an RDW will
not exist (at least not externally).
Sure. There is no dispute about that. The
only dispute is about VB binary files and
RECFM=U text files. You might want to
check RECFM=U text files as well, and
see what you think. IBM C again runs
all the text together if you read a text
file in binary mode. But this time for a
different reason. It is because for text
files it uses the block boundary as a
line terminator, but binary mode ignores
that.
Post by Mike Rayborn ***@comcast.net [H390-MVS]For some this will seem strange
and different from what IBM's IND$FILE does. I can't be sure if it is
or isn't, just that I don't remember IBM doing it this way, so maybe
that will cause some confusion.
There will be no confusion if people simply
store their ZIP files in RECFM=U where
they belong, instead of RECFM=VB where
there is a dispute.
I don't know any valid reason why people
should insist that VB behave like U and
then insist that they want to use VB
instead of U.
Post by Mike Rayborn ***@comcast.net [H390-MVS]In any case, handling RECFM=VB datasets this way for BINARY transfers
can be very handy for downloading SMF datasets.
Yes, and it extends in general. It's not
just IND$FILE, it's anything that is
processing a RECFM=VB dataset on
the mainframe. Do you expect a
gzip/gunzip sequence to preserve or
trash both an SMF file and a text file?
PDPCLIB preserves both. IBM trashes
both.
Post by Mike Rayborn ***@comcast.net [H390-MVS]In most cases, if you're uploading a binary dataset from the PC to MVS,
the target should be a RECFM=U dataset. So files like ZIP, GIF, JPG,
etc, remain consistent across platforms as long as they reside on the
mainframe as RECFM=U datasets.
Yes, exactly correct, in my opinion.
Post by Mike Rayborn ***@comcast.net [H390-MVS]I don't usually bite on comments like this, and maybe your asking
nicely, but it's sure hard to tell from the perceived tone of your comments.
Please ignore somitcw. His dispute is
with me, not you. We've been clashing
over this and other issues for many
years.
BFN. Paul.