Operating System - OpenVMS

SFTP truncates files from VMS to Unix

New Member

SFTP truncates files from VMS to Unix

I am having a problem with SFTP truncating files when transfering from a VMS box over to a Unix box.

The size of the files are around 5000 blocks. When viewing them on the destination unix server they are truncated.

Do I need to run some sort of file conversion on VMS prior to SFTing them over ? (CONVERT/FDL).

Any advice would be appreciated. (we're running Open VMS V7.3-2).
Richard Whalen
Honored Contributor

Re: SFTP truncates files from VMS to Unix

What TCP/IP stack are you using (TCP/IP Services, MultiNet or TCPware)? Are you up to date on your patches? Can you duplicate the problem with a smaller file?

SFTP was designed as a binary file access protocol and did not originally include any provisions for the various formats that systems may use for text files. Later versions of the specification included a text file access method, but these are not widely implemented. Converting the file to Stream-LF first may help.
New Member

Re: SFTP truncates files from VMS to Unix

Hi Richard,

Thanks for your reply. We have UCX installed. HP TCP/IP Services For OpenVMs Alpha Version V5.4 - ECO 6.

We've tried SFTPing using binary.

We already have SFTP's in place that succesfully transmit smaller files from the same VMS box to other Unix clients.

Silly question here, but how do I convert the file to stream_LF. I know I'll need to use the CONVERT command. Is there a specific existing FDL I need to use, or do I have to create one ?

Sorry if I sound rather ignorant, but I'm not a VMS specialist.
Richard Whalen
Honored Contributor

Re: SFTP truncates files from VMS to Unix

Create STMLF.FDL with the following text in it:
CARRIAGE_CONTROL carriage_return
FORMAT stream_LF

$ Convert original_file new_file/fdl=stmlf.fdl
Steven Schweda
Honored Contributor

Re: SFTP truncates files from VMS to Unix

As usual, it might be helpful to see the
actual commands and their actual output, so
we might know exactly what you did, and see
the evidence for your claims.

Around here, for example:

alp $ tcpip show version

HP TCP/IP Services for OpenVMS Alpha Version V5.4 - ECO 7
on a COMPAQ Professional Workstation XP1000 running OpenVMS V7.3-2

alp $ sftp "-V"
alp$dka0:[sys0.syscommon.][sysexe]tcpip$ssh_sftp2.exe: SSH Secure Shell OpenVMS
(V5.5) 3.2.0 on COMPAQ Professional Workstation - VMS V7.3-2

alp $ dire /size lpv38553.pdf

Directory ALP$DKA0:[SMS]

LPV38553.PDF;1 7471

Total of 1 file, 7471 blocks.

Now, that's a Record format: Stream_LF file
already. DIRE /FULL, or:

alp $ write sys$output f$file_attributes( "lpv38553.pdf", "RFM")

alp $ pipe write sys$output "put lpv38553.pdf" | sftp "-B" - sol
sftp> put lpv38553.pdf
lpv38553.pdf | 3.6MB | 3735.4 kB/s | TOC: 00:00:01 | 100%

Ssh2SftpServer/SSHFILEXFERS.C:2909: Received SSH_FXP_CLOSE
Ssh2SftpServer/SSHFILEXFERS.C:3013: Closed file `lpv38553.pdf' (handle=6832ad)
alp $

sol> uname -a
SunOS sol 5.10 Generic_137137-09 sun4u sparc sun4u

sol> ls -l lpv38553.pdf
-rwxr-xr-- 1 sms users 3825026 Feb 10 07:54 lpv38553.pdf

(And the last page of the document looks ok
in Adobe Reader.)

> [...] how do I convert the file to
> stream_LF. [...]

That depends on what's in the file, and what
its attributes are now. Perhaps CONVERT,
perhaps SET FILE /ATTRIBUTES, perhaps some
even more complex scheme. (Or, perhaps, do
nothing.) For a start:

DIRE /FULL your_file
Thomas Ritter
Respected Contributor

Re: SFTP truncates files from VMS to Unix

You may avoid the problem by sending zipped files and then unzipping at the unix end.
New Member

Re: SFTP truncates files from VMS to Unix

Thanks for all your responses.

Richard, I created the FDL file as you specified, ran a convert and then re-ran the SFTP.

Looking at the files on the unix box I can see they now both have trailer headers. which would indicate that this has resolved the problem.

I'm waiting for the user to confirm this. But so far it looks good. Thank you for your help.
New Member

Re: SFTP truncates files from VMS to Unix

Richard, i had the same problem posted here, but also have the same problem transferring files from vms to windows using sftp.

I´ve used the fdl file but windows files doesn´t have the same characteristics than unix, so my question is to know how to build another fdl file to convert files in vms and transfer theese files to an windows enviroment using sftp.




Honored Contributor

Re: SFTP truncates files from VMS to Unix

This thread is 2.5 years old, and not necessarily particularly related to this question.


Please repost this as your own thread.  


When you repost this question as your own thread, please also consider posting a few details around the particular problem(s) you are encountering with whichever version of Windows is in use here, such as the specific file transfer commands commands used, the RMS file formats involved (DIRECTORY/FULL can be shown here), and the patch level of this OpenVMS implementation.


Stream LF files are a more common choice, when transfering to Windows boxes, for instance.


If there's a corruption, a dump of the first hunk of the file might be useful.  The first few records, for instance, if the file is a sequential file.


Definitely patch your TCP/IP Services (or whatever the IP stack you're using) to current, or upgrade, or betterm both.  


Windows doesn't do ssh and sftp by default, so you'll want to identify the products in use there, too.  And whether those versions are current or patched to current, too.


If you're running an XP-vintage implementation in this configuration, also try testing with or moving to something less problematic; an upgrade to Windows 7, Mac OS X, Unix, etc.