|
Unattended File Transfers
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 (SCP2GET from SAMPLIB ), 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 EXEC PGM=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDENV DD DSN=&SYSUID..SSZ.SRVR542.PARMLIB(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=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET.out',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET.err',
// 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 (SCP2PUT from SAMPLIB ), a specific
translate table is used for codeset translation and the source dataset
is defined using a DD card.
//SCP2PUT EXEC PGM=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2PUT.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2PUT.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDENV DD DSN=&SYSUID..SSZ.SRVR542.PARMLIB(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=IKJEFT1A,
// DYNAMNBR=75,
// TIME=100,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2PUT.out',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2PUT.err',
// 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 (SCP2GET2 from SAMPLIB ), the
destination dataset is defined and pre-allocated using a DD card.
//SCP2GET2 EXEC PGM=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET2.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET2.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDENV DD DSN=&SYSUID..SSZ.SRVR542.PARMLIB(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=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET2.out',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET2.err',
// 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 (SCP2GET3 from SAMPLIB ), the remote
file is transferred to mainframe as a PDS member. The FB80
profile defines the needed dataset characteristics and codeset
translation.
//SCP2GET3 EXEC PGM=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET3.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET3.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDENV DD DSN=&SYSUID..SSZ.SRVR542.PARMLIB(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=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SCP2GET3.out',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/tmp/&SYSUID.-SCP2GET3.err',
// 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
In this example (SFTP2BAT from SAMPLIB ), SFTP is run
in batch mode.
//SFTP2BAT EXEC PGM=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SFTP2BAT.out',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDERR DD PATH='/tmp/&SYSUID.-SFTP2BAT.err',
// PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
// PATHMODE=(SIRUSR,SIWUSR)
//STDENV DD DSN=&SYSUID..SSZ.SRVR542.PARMLIB(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=IKJEFT1A,
// DYNAMNBR=75,
// TIME=1440,
// REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT DD PATH='/tmp/&SYSUID.-SFTP2BAT.out',
// PATHOPTS=(ORDONLY),
// PATHDISP=(DELETE,KEEP)
//STDERR DD PATH='/tmp/&SYSUID.-SFTP2BAT.err',
// 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 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
|
[Contents]
[Index]
[ Contact Information | Support | Feedback | SSH Home Page | SSH Products ]
Copyright © 2007 SSH Communications Security Corp.
This software is protected by international copyright laws. All rights reserved.
Copyright Notice
|
|
|