Page 2 of 2

Re: ftp: send variable length binary (VB) file to mainframe

PostPosted: Thu Oct 02, 2008 10:16 am
by bakinsoda
transferring using ftp in unix, not sas. i know u could use the bin option in ftp, but what about rdw and bdw. i want to create those as well.

Re: ftp: send variable length binary (VB) file to mainframe

PostPosted: Mon Dec 19, 2011 5:27 pm
by MSwanberg
This sort of thing is possible, but it takes a bit of programming. Nothing too in-depth, though.

Mainframe FTP servers have what's called Mode B. (Note, I'm doing this from memory, so my syntax might not be 100% accurate). Access Mode B with the QUOTE MODE B command.

Mode B files have each record started with a x'80' followed by 2 bytes describing, in binary, the length of the record. So, a quick Perl script or VBScript program could transform the file on the PC side into a Mode B file. Read each record, get the length, and then write the record starting with x'80' and the 2-byte length.

Next, when sending the file via FTP to the mainframe, be sure to do a QUOTE SITE command to set the VB and LRECL, then do BINARY and then QUOTE MODE B. Then, when you send the file, the mainframe FTP server will interrogate each record's x'80' and 2-byte length descriptor and use that for the length of that record.

If you have any questions about Mode B, a google search will bring up plenty of information. I use this format very frequently... but I have scripts to do the heavy lifting which is why I don't know the syntax perfectly.

Re: ftp: send variable length binary (VB) file to mainframe

PostPosted: Tue Dec 20, 2011 1:47 am
by dick scherrer
Hello and welcome to the forum,

Please note that this topic has been dormant for more than 3 years :)

Usually it is best to reply to topics that are currently active (or have only been inactive for a few months).

Hope we have some things you find interesting ;)

d