Next Previous Contents

7. File transfer

Files can be transferred from MVS to Unix via the network with the ftp(1) command. To connect to the ICC mainframe, one types on the Unix command line ftp iccmvs3.unicc.org. One it prompted for one's user name and password on the MVS system. After logging in, one can type ls at the ftp> prompt to see a short list of files with the current MVS file prefix (normally one's MVS user ID) or dir for a more detailed list.

7.1 Automatic FTP login - a time-saver

One can create a file on the Unix system called ~/.netrc that contains username-password information that allows automatic login when using ftp. Here is an example of ~/.netrc:


machine iccmvs3.unicc.org login rossen password spudmeister

Since the passwords are completely visible in this file, it is essential that only the owner of the file have read-write permissions. Most ftp(1) clients will refuse to even start if ~/.netrc is insecure. Permissions are set with the chmod(1) command. In this case, we would type chmod u+rw,og-rw ~/.netrc or chmod 600 ~/.netrc to secure the ~/.netrc file.

7.2 Aliases - yet another Unix time-saver

Aliases are macros usually set up by a user to be equivalent to commands with many options preset. When the alias is entered on the command line, it gets replaced by the associated command. If one is constantly FTPing to the same machine, iccmvs3.unicc.org for example, it makes sense to define an alias instead of having to type ftp iccmvs3.unicc.org all of the time. Aliases are defined on the command line or in a script file like so:


$ alias mvs='ftp iccmvs3.unicc.org'

After this is done, all one has to do to open an FTP connection to the ICC is type mvs on the command line.

7.3 Binary, ASCII, and EBCDIC transfers

When transferring a file with ftp(1), one must first specify if any translation is to be done.

By typing type binary at the ftp> prompt, one is saying that files should be sent and received without any translation whatsoever.

If one specifies type ascii, one is saying that the files should be translated to the 7-bit ASCII character set.

If one specifies type ebcdic, the files will sent and received in the 7-bit EBCDIC character set.

It is essential that binary files such as PKZIP archives and SAS CPORT files be transferred with type set to binary.

It is common to send English-language text files with type set to ascii (or ebcdic if one is sending to an IBM mainframe), but this is not recommended for text files written with accented characters that require 8 bits. It is necessary to use type binary for such text files.

7.4 Directory navigation with cd

The cd command in ftp(1) is similar to the cd(1) command of Unix, but with a few nuances on MVS systems due to different file naming conventions.

On Unix systems

To go up a level in the directory tree, one types cd .. at the ftp> prompt.

To go down a level in the directory tree, one types cd name_of_a_subdirectory.

To go to a specific directory, one types cd complete_name_of_directory.

On Unix systems, directory and file names are case-sensitive.

On MVS systems

To remove the last level from the current file prefix, one types cd .. at the ftp> prompt.

To add a level to the current file prefix, one types cdname_of_the_level.

To change to a specific prefix, type the prefix in single quotes like this: cd 'LOSTPC'.

On MVS one can type directory and file names in upper or lower case - it does not matter.


Next Previous Contents