Operating System - OpenVMS
Showing results for 
Search instead for 
Did you mean: 

SFTP truncates files from VMS to Unix

Occasional Visitor

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.
Occasional Visitor

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.