SFTP z/OS RECFM=V Records Truncated

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
kdl1985
Posts: 16
Joined: Thu Sep 22, 2011 2:33 pm

SFTP z/OS RECFM=V Records Truncated

Post by kdl1985 »

We are setting up the following SFTP batch job to upload a RECFM=V data set to a vendor:

//STEPLIB DD DISP=SHR,DSN=DOVETAIL.COZ.LOADLIB
//SYSOUT DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDERR DD SYSOUT=*
//UPLOAD1 DD DSN=UPLOAD.FTP,DISP=SHR
//STDIN DD *
# Customize these ...
coz_bin="/usr/local/coz/bin"
ruser="user"
server="xxxxxx.com"
servercp="ISO8859-1"

# These can be used to read the ssh password from a (secured) dataset
# if you don't want to setup public/private keypairs
export PASSWD_DSN='PASSWORD.FTP'
export SSH_ASKPASS=$coz_bin/read_passwd_dsn.sh
export DISPLAY=none

ssh_opts="-oBatchMode=no"
ssh_opts="$ssh_opts -oPort=11500"
ssh_opts="$ssh_opts -oConnectTimeout=60"
ssh_opts="$ssh_opts -oServerAliveInterval=60"
ssh_opts="$ssh_opts -oStrictHostKeyChecking=yes"

# Invoke the Co:Z sftp client with an in-line batch of commands
# that downloads a remote file to a local DD.
# Note that "-oBatchMode=no" must be specified before "-b"
# since ssh opts are first-sticky

$coz_bin/cozsftp $ssh_opts -b- $ruser@$server <<EOB
lzopts mode=text,recfm=V,servercp=$servercp

PUT //DD:UPLOAD1 xxxxx.txt
EOB

The vendor reported that the data set was received, however the header and trailer records needed to be 256 characters plus a LF ( 257 characters total), but they were truncated. It appeared that the trailing spaces were removed from the record.

A review of the data set on the z/OS system show they have a record length of 256.

We were able to get around the problem by inserting an "X" in the 256 position of the header and trailer record, however we were wondering if there was an option to prevent the trailing spaces from being removed from a RECFM=V record.
kdl1985
Posts: 16
Joined: Thu Sep 22, 2011 2:33 pm

Re: SFTP z/OS RECFM=V Records Truncated

Post by kdl1985 »

Of course I found the NOTRIM option after posting. I will give it a try.
kdl1985
Posts: 16
Joined: Thu Sep 22, 2011 2:33 pm

Re: SFTP z/OS RECFM=V Records Truncated

Post by kdl1985 »

The NOTRIM option resolved our issue.
Post Reply