|
Unattended File Transfers Using the z/OS Client
Unattended file transfers of MVS datasets can be executed in JCL by
BPXBATCH , BPXBATSL , or oshell . scp2 uses
the same syntax for interactive and unattended file transfers.
sftp2 has a batch mode for non-interactive file transfers.
Note: User interaction is not possible when using unattended file transfers.
Users must be set up to use a non-interactive authentication method, like
public key without a passphrase, for unattended use.
Because user interaction is not possible, the server host key must be stored
on disk before unattended file transfers will succeed. More information
about storing the remote server keys can be found in Appendix Example of Distributing Keys.
The sample scripts shown in this section can also be found in the
/usr/lpp/ssh2/doc/zOS/SAMPLIB directory.
File Transfers Using the scp2 z/OS Client
Example 1: A Unix file transferred to a z/OS sequential dataset.
In this example, manual codeset translation parameters are used for
overriding the possible file transfer profiles. Required environment
variables are defined by using the STDENV DD card. The
scp2 command is run by BPXBATCH . Separate step for
printing the stdout and stderr message files is required in order to get
correct return code from the file transfer operation.
/* SCP2GET - Get a remote file into a MVS data set
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/*
/* Execute the SSH Tectia client program scp2. Use
/* public key authentication.
/*
/* Copy a remote file into a data set. If the data set
/* does not exist it is created with default values
/* recfm VB and lrecl 1024.
/*
/* Print the stdout and stderr message files to SYSOUT.
/*
//SCP2GET EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=SSHD2.SSZ.SAMPLIB(SSHENV),
// DISP=SHR
//SYSTSIN DD *
BPXBATCH PGM /usr/lpp/ssh2/bin/scp2 +
-oallowedauthentications=publickey +
testuser@remote_host:textfile.txt +
/FTADV:F=LINE,C=ISO8859-1,D=IBM-1047/__TEST.TEXTFILE
/*
//STDPR EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDOUTPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//STDERRPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//SYSTSIN DD *
OCOPY INDD(STDOUT) OUTDD(STDOUTPR) TEXT
OCOPY INDD(STDERR) OUTDD(STDERRPR) TEXT
/*
|
Example 2: A z/OS sequential dataset transferred to a Unix file.
In this example, a specific translate table is used for codeset translation
and the source dataset is defined using a DD card.
/* SCP2PUT - Put MVS dataset to remote unix file
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/* _BPX_SHAREAS=MUST
/*
/* Source dataset name is defined using PROGLI DD card
/*
/* Executes the SSH Tectia client program scp2 using
/* public key authentication and translate table
/* 'TCPIP.STANDARD.TCPXLBIN' for codeset translation.
/* Copies the dataset to remote unix file.
/*
/* NOTE: BPXBATSL MUST be used if datasets are defined
/* using DD cards
/*
/* Print the stdout and stderr message files to SYSOUT.
/*
//SCP2PUT EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2put_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./scp2put_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=&SYSUID..SSZ.SAMPLIB(SSHENV),
// DISP=SHR
//PROGLI DD DSN=&SYSUID..TEST.C.LIST,
// DISP=SHR
//SYSTSIN DD *
BPXBATSL PGM /usr/lpp/ssh2/bin/scp2 +
-oallowedauthentications=publickey +
/FTADV:E=STANDARD,A=___TCPIP.%T.TCPXLBIN,F=LINE///DD:PROGLI +
testuser@remote_host:test_c.list
/*
//STDPR EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDOUTPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//STDERRPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//SYSTSIN DD *
OCOPY INDD(STDOUT) OUTDD(STDOUTPR) TEXT
OCOPY INDD(STDERR) OUTDD(STDERRPR) TEXT
/*
|
Example 3: A Unix file transferred to a z/OS sequential dataset.
In this example, the destination dataset is defined and pre-allocated using a DD card.
/* SCP2GET2 - Get a remote file into a pre-allocated
/* MVS data set
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/* _BPX_SHAREAS=MUST
/*
/* Dataset is allocated using TESTFI DD card
/*
/* Execute the SSH Tectia client program scp2. Use
/* public key authentication.
/* Copy a remote file into a pre-allocated data set.
/*
/* NOTE: BPXBATSL MUST be used if datasets are defined
/* using DD cards
/*
/* Print the stdout and stderr message files to SYSOUT.
/*
//SCP2GET2 EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get2_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./scp2get2_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=&SYSUID..SSZ.SAMPLIB(SSHENV),
// DISP=SHR
//TESTFI DD DSN=USER1.FILE.PS.TEST1,
// DISP=(NEW,CATLG),
// VOL=SER=Z6SYS1,
// SPACE=(TRK,(2,2)),
// DCB=(RECFM=VB,LRECL=1024,BLKSIZE=27998)
//SYSTSIN DD *
BPXBATSL PGM /usr/lpp/ssh2/bin/scp2 +
-oallowedauthentications=publickey +
user1@_remoteserver:textfile.txt +
//DD:TESTFI
/*
//STDPR EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDOUTPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//STDERRPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//SYSTSIN DD *
OCOPY INDD(STDOUT) OUTDD(STDOUTPR) TEXT
OCOPY INDD(STDERR) OUTDD(STDERRPR) TEXT
/*
|
Example 4: A Windows file transferred to a partitioned dataset member.
In this example, the remote file is transferred to mainframe as a PDS
member. The FB80 profile defines the needed dataset characteristics
and codeset translation.
/* SCP2GET3 - Get a remote file into a dataset member
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/*
/* Execute the SSH Tectia client program scp2 using
/* public key authentication. Copy a remote file
/* into a PDS member using lrecl 80 and recfm FB.
/* If the PDS does not exist, it is automatically created
/*
/* Print the stdout and stderr message files to SYSOUT.
/*
//SCP2GET2 EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//SYSUADS DD DSN=SYS1.UADS,DISP=SHR
//SYSLBC DD DSN=SYS1.BRODCAST,DISP=SHR
//STDOUT DD PATH='/home/&SYSUID./scp2get3_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./scp2get3_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=&SYSUID..SSZ.SAMPLIB(SSHENV),
// DISP=SHR
//SYSTSIN DD *
BPXBATCH PGM /usr/lpp/ssh2/bin/scp2 +
-oallowedauthentications=publickey +
user1@_remoteserver:jcl.txt +
/FTADV:P=FB80,T=PDS/___USER1.JCLLIB/JCL1
/*
//STDPR EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDOUTPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//STDERRPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//SYSTSIN DD *
OCOPY INDD(STDOUT) OUTDD(STDOUTPR) TEXT
OCOPY INDD(STDERR) OUTDD(STDERRPR) TEXT
/*
|
File Transfers Using the sftp2 z/OS Client
The sftp2 file transfer application can be run in batch mode for
non-interactive file transfers.
Example 1: Batch file transfer with two file transfers.
File transfer commands in the batch file "USER1.TRANSFER.BATCH " can
be, for example, the following:
sput /_FILE2.PS /home/user1/file1.dat
sget files/jcl /FTADV:P=FB80/___USER1.PDS/MEM1
|
/* SFTP2BAT - Get a remote file into a dataset member
/*
/* Required environment variables are defined using
/* SSHENV DD card. Required variables are
/* _CEE_RUNOPTS=FILETAG(AUTOCVT,NOAUTOTAG),TRAP(ON)
/* _BPXK_AUTOCVT=ON
/*
/* Execute the SSH Tectia client program sftp2 in batchmode
/* using public key authentication.
/* The batch file can contain for example the following commands:
/* sput /_FILE2.PS /home/user1/file1.dat
/* sget files/jcl /FTADV:P=FB80/___USER1.PDS/MEM1
/*
/*
/* Print the stdout and stderr message files to SYSOUT.
/*
//SFTP2BAT EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./sftp2bat_stdout',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDERR DD PATH='/home/&SYSUID./sftp2bat_stderr',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=SIRWXU
//STDENV DD DSN=USER1.SAMPLIB(SSHENV),
// DISP=SHR
//SYSTSIN DD *
BPXBATCH PGM /usr/lpp/ssh2/bin/sftp2 +
-oallowedauthentications=publickey +
-B //USER1.TRANSFER.BATCH +
user1@10.1.70.193
/*
//STDPR EXEC PGM=IKJEFT01,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/home/&SYSUID./scp2get_stdout',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/home/&SYSUID./scp2get_stderr',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDOUTPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//STDERRPR DD SYSOUT=*,
// DCB=(LRECL=4000,RECFM=VB)
//SYSTSIN DD *
OCOPY INDD(STDOUT) OUTDD(STDOUTPR) TEXT
OCOPY INDD(STDERR) OUTDD(STDERRPR) TEXT
/*
|
[Contents]
[Index]
[ Contact Information | Support | Feedback | SSH Home Page | SSH Products ]
Copyright © 2006 SSH Communications Security Corp.
This software is protected by international copyright laws. All rights reserved.
Copyright Notice
|
|
|