Your browser does not support HTML5 local storage or you have disabled it. Some functionality on this site, including saving your privacy settings and offering you special discounts, uses local storage and may not work with local storage disabled. We recommend allowing the use of local storage in your browser. In some browsers, it is the same setting used for disabling cookies.

SSH

Interactive File Transfers

Interactive file transfers can be used from Unix System Services shells, for example, OMVS, Telnet, or Secure Shell sessions can be used.

[Note]Note

In these examples, the ssh_ftadv_config.example file transfer profiles are used. See File Transfer Profiles for more information.

File Transfers Using the scpg3 z/OS Client

The scpg3 syntax is the following:

$ scpg3 user@source:source_file user@destination:destination_file

Local paths can be specified without the user@system: prefix.

[Note]Note

In the following examples, data set names that contain single quotes and/or parentheses are placed in regular quotation marks (" "). This must be done to prevent the shell from trying to interpret the single quotes and parentheses. Alternatively, you can use backslashes (\) to escape the single quotes and parentheses, for example //\'USER1.WINPDS\(MEM1\)\'.

Example 1: Fetch a Unix file into an MVS data set

A file transfer profile is not defined in the file transfer command, so the filename-matched profile is used if matched. In this case, the file name does not match any of the defined profiles, so the default profile is used (text format with code set conversion).

> scpg3 user1@10.1.70.193:source_file //FILE1.PS

or

$ scpg3 user1@10.1.70.193:source_file "//'USER1.FILE2.PS'"
Example 2: Put an MVS data set to a Unix file

A file transfer profile is not defined in the file transfer command, so the filename-matched profile is used if matched. The data set name has the ".Z" extension, so the correct profile is selected automatically (binary file transfer).

$ scpg3 "//'USER1.PDS.Z'" user1@10.1.70.193:/tmp/binaries/file.Z
Example 3: Fetch a Windows text file into a partitioned data set member

In this case, a Windows profile is used in order to do the Windows line delimiter conversion correctly. The profile also defines code set conversion.

Using a file transfer advice string:

$ scpg3 user1@10.1.70.100:textfile /ftadv:P=WIN///'USER1.WINPDS(MEM1)'

Or, alternatively, using a site parameter:

$ scpg3 --dst-site="P=WIN" user1@10.1.70.100:textfile "//'USER1.WINPDS(MEM1)'"
Example 4: Fetch a Windows text file into a fixed block partitioned data set member

A windows profile is used for code set and line delimiter conversions, but additional parameters are required for defining the Fixed Block file format.

Using a file transfer advice string:

$ scpg3 user1@10.1.70.100:jcl-file /ftadv:P=WIN,O=FB,R=80///'USER1.WINPDS(JCL)'

Or, alternatively, using site parameters:

$ scpg3 --dst-site="P=WIN,O=FB,R=80" user1@10.1.70.100:jcl-file "//'USER1.WINPDS(JCL)'"
Example 5: Copy a z/OS binary file to another z/OS system

To ensure that both parties handle the data set as binary, set the binary profile (P=BIN) or binary settings (X=BIN,F=STREAM) to both local and remote data sets. If you are not sure whether the profiles are enabled, use the binary settings (X=BIN,F=STREAM).

Using a file transfer advice string:

$ scpg3 /ftadv:P=BIN///LOCAL.BINARY \
  user@lpar2.example.com:/ftadv:X=BIN,F=STREAM///REMOTE.BINARY

Or, alternatively, using site parameters:

$ scpg3 --src-site="P=BIN" --dst-site="X=BIN,F=STREAM" //LOCAL.BINARY \
  user@lpar2.example.com://REMOTE.BINARY

File Transfers Using the sftpg3 z/OS Client

sftpg3 has the sput and sget commands that can be used for mainframe file transfers.

Example 1: Fetch a Unix file to a z/OS VSAM ESDS data set using filename-matched profiles

An sftpg3 connection is opened and a file is transferred from Unix to z/OS with the sget command.

The example assumes that you have set a filename-matched profile that matches textfile.txt.

$ sftpg3 user1@10.1.70.193
user1@10.1.70.193's password:
sftp> sget textfile.txt /ftadv:T=ESDS///FILE1.VSAM
textfile.txt                  |   49B |   49B/s | TOC: 00:00:01 | 100%
sftp> quit
Example 2: File listing and several interactive file transfers between z/OS and Unix
$ sftpg3 user1@10.1.70.193
user1@10.1.70.193's password:
sftp> ls 1
mainframe_files/
source_file
textfile.txt

sftp> cd mainframe_files 2
/home/user1/mainframe_files
sftp> ls 3
/home/user1/mainframe_files:
binary.dat
jcl
sftp> sget binary.dat //'USER1.BINARY.FILE' 4
binary.dat                    | 4.6kB | 4.6kB/s | TOC: 00:00:01 | 100%
sftp> ascii 5
sftp> sget jcl /ftadv:O=FB R=80///'USER1.PDS(MEM1)' 6
jcl                           |   98B |   98B/s | TOC: 00:00:01 | 100%
sftp> sput //FILE1.PS /tmp/result.txt 7
FILE1.PS                      |   49B |   49B/s | TOC: 00:00:01 | 100%
sftp> binary 8
sftp> sput //BINARY.FILE binary_file.dat 9
BINARY.FILE                   | 4.6kB | 4.6kB/s | TOC: 00:00:01 | 100%
1

List files in current working directory.

2

Change current working directory to mainframe_files.

3

List files in current working directory.

4

Get a file to an MVS data set.

5

Set transfer mode to ASCII.

6

Get an ASCII file into an MVS data set member, using a file transfer advice string to set recfm FB and lrecl 80.

7

Put an MVS data set to an ASCII file.

8

Set transfer mode to binary.

9

Put an MVS data set to a binary file.

===AUTO_SCHEMA_MARKUP===