Tectia

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. If OMVS shell is used, only non-interactive authentication methods can be used.

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.

Example 1: A Unix file transferred to a z/OS sequential dataset

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 filename does not match any of the defined profiles, so the default profile is used (text format with codeset 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: A z/OS sequential dataset transferred 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 dataset 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: A Windows text file transferred to a z/OS partitioned dataset member

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

$ scpg3 --dst-site="P=WIN" user1@10.1.70.100:textfile //\'USER1.WINPDS\(MEM1\)\'
Example 4: A Windows text file transferred to a z/OS fixed block partitioned dataset member

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

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

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

$ 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: A Unix file transferred to a z/OS VSAM ESDS dataset using filename-matched profiles

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

$ sftpg3 user1@10.1.70.193
user1@10.1.70.193's password:
sftp> lsite T=ESDS
sftp> sget textfile.txt //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
mainframe_files/
source_file
textfile.txt

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