SSH

File Transfers Using Command-Line Applications

Most of the examples in this section use Tectia Client. If not mentioned otherwise, also other clients can be used. The examples apply to both Unix and Windows command-line clients.

Interactive File Transfers Using Command-Line Applications

Tectia Client on Windows and Unix contain two file transfer clients.

  • scpg3 is a secure replacement for remote copy and provides easy secure interactive and non-interactive file transfers.

  • sftpg3 is a secure replacement for FTP and provides a user interface for interactive file transfers and a batch mode for unattended file transfers.

The file transfer formats are the same as described earlier.

Example 1: Copy a Unix file to an MVS partitioned data set member using the default file transfer profile.

$ scpg3 textfile.txt user1@zos:/__USER1.TEST2.PDS/MEMBER1

Example 2: Copy an MVS sequential data set to a Windows file using a Windows file transfer profile.

C:\> scpg3 user1@zos:/ftadv:P=WIN/___USER1.TEST2.PS.FILE c:\temp\my_file.txt

Example 3: Copy a partitioned data set with members to Unix a directory and files using the default file transfer profile.

$ scpg3 -r user1@zos:/_TEST2.PDS /tmp/pds/

Example 4: File transfers between Unix and z/OS using sftpg3.

$ sftpg3 user1@zos 1
user1@zos's password: 
sftp> sget /_TEST2.PDS/MEMBER1 /tmp/member1 2
sftp> sget /FTADV:X=BIN/__TEST.PS.FILE1 3
sftp> sput /tmp/local_file.txt /FTADV:P=FB80/___&SYSUID..SSZ.JCL1 4
1

Connect from Unix to z/OS using sftpg3.

2

Fetch an MVS PDS member into a Unix file.

3

Fetch an MVS data set. Use a file transfer advice string to set TRANSFER_MODE (X) to binary.

4

Put a Unix file to an MVS data set using file transfer profile FB80.

Note that, by default, a sequential data set - not a partitioned data set - is created. If you want to store your source file to a PDS, you can do it in one of the following ways:

  • First create the PDS using the mkdir command. After this you can put your source file to the PDS, giving a valid member name if the source file name is not suitable.

  • Specify the directory size (DIRECTORY_SIZE|M) in the file transfer advice string as follows:

    sftp> sput /tmp/local_file.txt /FTADV:P=FB80,M=10/___&SYSUID..SSZ.JCL1

Example 5: Using the sftpg3 site command to define additional data set parameters.

[Note]Note

The sftpg3 (l)site commands are recognized only by Tectia products. File transfer advice strings should be used with other clients than Tectia.

Parameters can be entered either one by one, or several parameters can be delimited by commas or spaces. Both long parameters and abbreviations can be used. The plain site command outputs the list of entered parameters.

sftp> site LRECL=80 1
sftp> site RECFM=FB,VOLUMES=TEST 2
sftp> site X=TEXT C=ISO8859-1 D=IBM-1047 3
sftp> site 4
LRECL=80
RECFM=FB
TRANSFER_CODESET=ISO8859-1
TRANSFER_FILE_CODESET=IBM-1047
TRANSFER_MODE=TEXT
VOLUMES=TEST
1

Set record length (LRECL).

2

Set record format (RECFM) and volumes (VOLUMES), separated by a comma

3

Set TRANSFER_MODE|X, TRANSFER_CODESET|C and TRANSFER_FILE_CODESET|D, separated by spaces.

4

List the currently set site parameters.

Example 6: File transfers using Unix OpenSSH client.

$ sftp user1@zos
Connecting to zos
user1@zos's password: 
sftp> get /_TEST2.PDS/MEMBER1 /tmp/member1
sftp> get /FTADV:X=BIN/__TEST.PS.FILE1
sftp> put /tmp/local_file.txt /FTADV:P=FB80/___&SYSUID..SSZ.JCL1

Note that, by default, a sequential data set - not a partitioned data set - is created. To store your source file to a PDS, follow the instructions presented in Example 4 above.

Unattended File Transfers Using Command-Line Applications

scpg3 commands can be used as Scheduled Tasks on Windows, or as cron jobs on Unix. With sftpg3, batch mode can be used. The syntaxes for scpg3 and sftpg3 are the same as described before.