Search code examples
ftpsftptandemhp-nonstop

FTP'ing structured files in binary mode


I am trying to FTP a file onto a Tandem HP/Non-Stop environment. The records are written to the file using a C process which are then read using another C process.

The file itself contains some records which are not readable using a standard text editor. I figured this meant that to transfer the file correctly i needed to transfer it in Binary mode. Trying the transfer in binary mode produces the following errors.

ftp> bin
200 Type set to I.
ftp> put SM11098
200 PORT command successful.
553 Error: Structured file transfer only allowed in Ascii mode,
ftp> ascii
200 Type set to A.
ftp> put SM11098
200 PORT command successful.
150 Opening data connection for SM11098 (10.220.98.237,4078d).
552 SM11098: Relative file record length > Maximum record length
ftp: 1576960 bytes sent in 4.08Seconds 386.70Kbytes/sec.

I tried to google the above errors but nothing came up. A structured file to me sounds like its a binary files that contain structured records. Shouldnt this be FTP'd in binary mode? The FTP program is forcing me to use ASCII mode.

What is the second error for? (i.e. "Relative file record length > Maximum record length")


Solution

  • Your post doesn't quite say, but it sounds like you are FTPing from an HP-NonStop to an HP-NonStop, and your source file is "structured". You need to be aware that in the NonStop environment, "structured file" has a specific meaning: the file is different from the one kind of file found on *nix or MS-DOS systems (which are called unstructured files on NonStop). Structured files are not an array of bytes, but have record boundaries, and potentially other characteristics, some of which are similar to characteristics of SQL tables.

    FTP works normally for unstructured files, but for structured files you'll probably need to fool with extra parameters. (FTP NonStop extensions are about the worst design found in the system software of NonStop, unfortunately for you.) Basically you need to use attributes after the and parameters on your put command, starting with the structured file type (which is "e", "k", or "r") and perhaps other attributes. That tells FTP you are transferring a structured file. You'll probably need to check the manual to get the syntax right. You'll need to use "ASCII mode" for this, despite having binary data.

    (The "Relative file record length" error is probably due to failure to do a structured file transfer. Using the file type "r" (which stands for Relative) would be appropriate if your source file is a relative structured file.)

    However, if both systems are NonStop, they typically would be networked using "Expand" networking (e.g. over IP), and then copying a file is easier than using FTP. You'd use your normal command interpreter and just put the system name as part of the destination file name of a normal copy or duplicate command.