IND$FILE, FTP or SFTP: which to use to move a file to or from z/OS
Compare IND$FILE, z/OS FTP and SFTP for moving files to a mainframe: what each needs, how text is converted, and which can write an MVS data set directly.
There are three common ways to get a file onto z/OS, or off it. They differ in what has to be running on the host, which network port you need, and what happens to text on the way.
At a glance
| | IND$FILE | FTP | SFTP | |---|---|---|---| | Runs over | your 3270 session | its own FTP connection | an SSH connection | | Host needs | IND$FILE, and a TSO or CMS command line | the z/OS FTP server | z/OS OpenSSH | | Text conversion | yes, with the ASCII option | yes, in ASCII mode | no, bytes are copied as they are | | Line ends to records | yes, with the CRLF option | yes, in ASCII mode | no | | Writes MVS data sets | yes | yes | not directly: z/OS UNIX files | | Set up a new data set | RECFM, LRECL, BLKSIZE, SPACE options | SITE RECFM, LRECL and space | not applicable |
IND$FILE: when all you have is the 3270 session
IND$FILE moves the file inside the 3270 session, so it needs no other port. That makes it the choice when your network only lets you reach the TN3270 port. You must be at a TSO READY prompt, ISPF option 6 or the CMS command line, and the host must have IND$FILE installed.
For text, turn on ASCII (translate to and from EBCDIC) and CRLF (each line is one record). For a binary file, turn both off. See IND$FILE file transfer and IND$FILE options.
FTP: data sets, with conversion
The z/OS FTP server writes straight into MVS data sets. In ASCII mode it converts text and stores each line as a record. Before you upload into a new data set, tell the server the record format and length with SITE (usually sent as QUOTE SITE from a non-z/OS client), or long lines fail or are cut. See EZA2537E and 451: z/OS FTP records longer than the LRECL.
FTP needs the FTP server running on z/OS and its port open to you. Ask the site which FTP setup they allow.
SFTP: files in z/OS UNIX, no conversion
IBM's OpenSSH on z/OS treats SFTP as binary: nothing is converted, and paths are z/OS UNIX files, not data sets. (Only IBM's own sftp client, run on z/OS, can convert text, with its ascii subcommand.) Text uploaded this way stays ASCII until you convert it on z/OS (for example with iconv) or tag it. To get it into a data set, copy it there with cp -T in a z/OS UNIX shell. The old scp protocol (scp -O) is the exception: IBM's scp converts text. The details are in SFTP and scp to z/OS: EBCDIC text conversion and data sets.
SFTP is the one to use when SSH is the only way in, or when the file belongs in z/OS UNIX anyway.
Quick choice
- Only the 3270 port is reachable: IND$FILE.
- Text into a new or existing data set, and the FTP server is available: FTP in ASCII mode with
SITE LRECL. - Binary files, z/OS UNIX files, or SSH is the only door: SFTP.
Related
- IND$FILE file transfer
- IND$FILE options
- EZA2537E and 451: z/OS FTP records longer than the LRECL
- SFTP and scp to z/OS: EBCDIC text conversion and data sets
- Paste text into a 3270 screen without breaking the columns