Can I connect to a mainframe server? (e.g. VMS, MVS, AS/400)
Mainframe systems have some specifics. Some of those are addressed below.
Path Format
WinSCP in general requires the server to follow *nix path semantics – hierarchical paths starting with a slash, with individual path components separated by slashes.
SFTP
This is not a problem, if your server supports SFTP protocol, as the SFTP protocol itself mandates *unix-like path format. So even if the server itself uses a different native path format, it has to emulate the *nix format for SFTP.
FTP
On the contrary, FTP protocol does not have such requirement. It allows the server to keep its native path format. WinSCP has limited support for working with such paths. In some cases it can work, but not always.
Some servers allow switching to *nix path format optionally. For example to configure IBM Power Systems (IBM System i, eServer iSeries, AS/400) for Unix/WinSCP compatibility, use following two Post login commands:
site namefmt 1 site listfmt 1
Refer to IBM documentation for these commands. See also topic on connecting to IBM Power Systems server with WinSCP.
Record Length and Other Remote File Parameters
To set record length or other parameters for files that are about to be uploaded, use the methods described below.
FTP
Execute a similar command from Console window:
SITE FIXrecfm 128 Lrecl=128 Recfm=FB BlockSize=6144
In scripting, use call
command:
call SITE FIXrecfm 128 Lrecl=128 Recfm=FB BlockSize=6144
In .NET assembly, use Session.ExecuteCommand
method:
$session.ExecuteCommand("SITE FIXrecfm 128 Lrecl=128 Recfm=FB BlockSize=6144")
SFTP
SFTP protocol does not have a generic way to execute server-specific commands, like FTP does with its SITE
command. For this reason, mainframe SFTP servers allow passing parameters using a special syntax of a path provided to a directory listing request.
For example in scripting, you can use the following format of ls
command to set the parameters:
ls /+recfm=fb,lrecl=2214,blksize=0,replace/
In .NET assembly, use Session.ListDirectory
method:
$session.ListDirectory("/+recfm=fb,lrecl=2214,blksize=0,replace/")