Tags

,

The HP ITRC Forums has a thread on problems transferring files to OpenVMS using SFTP. The symptoms were that transferring files to OpenVMS would result in a corrupted file.

The problem’s cause was rather insidious: due to the way file versioning works, the new file inherits the old version’s attributes, which could be incompatible with the UNIX file format. When this occurs, the result is a corrupted file.

The fix is to convert the file attributes to StreamLF. Steven Schweda recommended this utility:

$! 12 December 1999. SMS.
$!
$! CONVERT a file to StreamLF record format.
$!
$ convert 'p1' 'p2' /fdl = sys$input:
RECORD
FORMAT stream_lf
$!

Steven also suggests this utility, which finds all files that are non-streamlf – with an optional parameter specifying files to look at:

$! 9 November 2006. SMS.
$!
$! Find non-directory files matching P1 which are not
$! Record format: Stream_LF.
$!
$!
$ if (p1 .eqs. "")
$ then
$ p1 = "[...]*.*;*"
$ endif
$!
$ file_old = ""
$ loop_top:
$!
$ file = f$search( p1)
$ if ((file .eqs. "") .or. (file .eqs. file_old)) then goto loop_end
$!
$ file_old = file
$ if (.not. f$file_attributes( file, "DIRECTORY"))
$ then
$!
$ rfm = f$file_attributes( file, "RFM")
$ if (rfm .nes. "STMLF")
$ then
$ write sys$output "''rfm' ''file'"
$ endif
$!
$ endif
$!
$ goto loop_top
$!
$ loop_end:
$!

The rule is: when working with UNIX files on OpenVMS, create a streamlf file first! This will prevent corrupted files.

Advertisements