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 scp2
z/OS Client
The scp2
syntax is the following:
> scp2 source_file_name destination_file_name
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).
> scp2 user1@10.1.70.193:source_file /_FILE1.PS
or
> scp2 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).
> scp2 /__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.
> scp2 user1@10.1.70.100:textfile /FTADV:P=WIN/___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.
> scp2 user1@10.1.70.100:jcl-file /FTADV:P=WIN,O=FB,R=80/___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
).
> scp2 /FTADV:P=BIN/__LOCAL.BINARY \
user@lpar2.example.com:/FTADV:X=BIN,F=STREAM/__REMOTE.BINARY
File Transfers Using the sftp2
z/OS Client
sftp2
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 dataset using filename-matched profiles
An sftp2
connection is opened and a file is transferred from Unix
to z/OS with the sget
command.
> sftp2 user1@10.1.70.193
user1@10.1.70.193's password:
sftp> sget textfile.txt /FTADV:T=VSAM/__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
> sftp2 user1@10.1.70.193
user1@10.1.70.193's password:
sftp> ls
mainframe_files/
source_file
textfile.txt
sftp> cd mainframe_files
sftp> ls
.:
binary.dat
jcl
sftp> sget binary.dat /__USER1.BINARY.FILE
binary.dat | 4.6kB | 4.6kB/s | TOC: 00:00:01 | 100%
sftp> sget jcl /FTADV:P=FB80/___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> sput /FTADV:X=BIN/__BINARY.FILE binary_file.dat
__BINARY.FILE | 4.6kB | 4.6kB/s | TOC: 00:00:01 | 100%
|