Archived Forum Post

Index of archived forum posts


SSH/SFTP Upload to Mainframe?

Mar 26 '13 at 14:31

We currently have applications that upload files to mainframes, and those applications issue a SITE command prior to executing the PUT command. We use this to set record lengths and cylinder sizes; without those commands, the PUT will either fail or pad each record to a default number of bytes.

The mainframe SSH software we are using (CoZ), overloads the LS command to accomplish the equivalent of FTP’s SITE command. We would pass the name/value pairs after LS /+ (LS /+ recl=150, for example).

I’ve looked through the properties and methods exposed by the Sftp class and I couldn’t locate anything that we could use that would allow us to execute a command string to the SSH server. Is there a way for us to use ChilKat to pass a command directly to the server?


FYI, I found a way to get the site message to the host server. Since our mainframe SSH host (CoZ) overloads the LS method for this purpose, I tried passing the overload syntax in the OpenDir method prior to executing the upload and it worked. I guess OpenDir issues an LS command.

I’m guessing this would only work for CoZ server implementations.


You can use the quote method , here in C#:

string strFtpOptions = "site lrecl=64 blksize=64 primary=1 secondary=1";
strFtpOptions = strFtpOptions.ToUpper();