What is the meaning of the first byte of each record set when downloading a v(b)-file from z/OS over FTP using "TYPE E" and "MODE B"

417 views Asked by At

Right now, I'm trying to upload and download files with variable record lengths from an IBM mainframe running zOS 2.1. Like this guy: How to FTP a variable length file from linux to mainframe z/OS

curl --user "******" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'" | hexdump

0000000 dead cafe babe
0000006


curl --user "******" --quote "site RDw" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'" | hexdump
0000000 000a 0000 dead cafe babe
000000a

It looks good. The rdw is "000a 0000" and the record "dead cafe babe". But. If I upload it again - even while using "quote site RDw" the server will ignore the RDW and store it as part of the actual data.

curl --user "******" --quote "site RDw" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'" > SOME.FILE.NAME
cat SOME.FILE.NAME | curl --user "******" --upload-file "-" --quote "site RDw" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'"
0000000 000c 0000 0008 0000 dead beef
000000c

Since that's not what I wanted, I searched some more. And - I found this article: http://www-01.ibm.com/support/docview.wss?uid=swg21188301

And gave it another try.

curl --user "******" --quote "TYPE E" --quote "MODE B" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'" | hexdump
0000000 4000 04de adbe ef00
0000007

That looked interesting. So I compared it with another file, containing a larger dataset...

0000000 4002 cbdc...
00002ce

And another one...

0000000 8000 16f0...
0000019 4000 16f0...
0000032

My first impression is: An 80 seems to indicate that there will be more datasets, whereas the 40 indicates the last one. That seemed to be true for every file I tried. For a normal file with variable record lengths as well as for a blocked file withe variable record lengths.

So I tried to upload it again...

curl --user "******" --quote "TYPE E" --quote "MODE B" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'" > SOME.FILE.NAME
cat SOME.FILE.NAME | curl --user "******" --upload-file "-" --quote "TYPE E" --quote "MODE B" --verbose --silent --show-error "ftp://themainframe/'SOME.FILE.NAME'"

And it seemed to work

Well - at least now I'm able to transfer files with variable record lengths from and to the mainframe while preserving the record lengths.

But - and here is the question: Is the first byte of each record "only" an indicator for wheather there will be more data sets? Or am I missing something?

1

There are 1 answers

0
SaggingRufus On

The first byte of a variable block record is the record length, so that's what you are seeing