0

I have some files on an OpenVms system. .xml, .cfg, and some binary files. The encoding type of those files is ANSI. When I use FTP mode binary to download, all works fine.

But if I use SFTP (doesn't matter which client I use) to download, extra NUL characters are added in the file.

Does anyone have the same problem?

pfx
  • 20,323
  • 43
  • 37
  • 57
  • Stackoverflow is for help with software development. You should consider asking questions like this on [su]. – Kenster Aug 23 '18 at 20:19

2 Answers2

3

user8436611, there is no such thing as an 'ANSI' file in OpenVMS terminology. Perhaps you mean a file containing simple 7-bit ASCII characters only ??

On OpenVMS simple 'sequential' files holding simple text, can still have multiple record 'formats'.

The native OpenVMS format is called VARIABLE LENGTH. Use DIRECTORY /FULL to report the file type or the DCL command $ WRITE SYS$OUTPUT F$FILE_ATTRIBUTES(filespec,"RFM") For a variable length file, each record (line) is prefix with a (16-bit) word aligned, (16 bit) binary length indicator word. For a 'short' line (< 256 bytes) that will show a binary zero byte. And any odd-length record will appear to be followed by a null-byte to align the next record length word. (word = int-2)

If such file is transferred binary, most tools will chunk it up in 512 bytes blocks, with that control word, and optional align byte included, looking like binary zeros on the other side.

Therefor, as Mark Diaz indicated you need to tell your tool to transfer in 'ASCII' or 'TEXT' mode.

OpenVMS also supports 'normal' files where each record (line) is followed by a terminator which can be a Linefeed (Unix), Carriage-return, or CR-LF (windows).

If your OpenVMS file is indeed the normal-for-OpenVMS variable length file as I suspect, then you could consider 'converting' it to 'Stream_LF' using an 'FDL' file or string. Example DCL command: $ CONVERT/FDL="RECORD; FORMAT STREAM_LF" old.dat new.dat

Good luck, Hein

Hein
  • 1,453
  • 8
  • 8
0

Agree this may not be the best forum for the question. But, in general, if you have what are essentially text files (xml) explicitly setting the FTP transfer mode to text should help. Some FTP servers/clients guess if the file is text or binary based on the file type (.xml).

Mark Diaz
  • 193
  • 1
  • 10
  • 1
    I strongly disagree. OpenVMS is unfortunately a special animal in this context. This is the right forum. The question is as close to programming as super-user since bits and bytes knowledge might be needed. It is _supposed_ to work seamlessly in ASCI (text) mode, but should fail in binary mode contrary to the OP's writing. – Hein Oct 10 '18 at 14:16