Unattended file transfers of MVS data sets can be executed in JCL by
BPXBATCH
, BPXBATSL
, or oshell
. scpg3 uses
the same syntax for interactive and unattended file transfers.
sftpg3 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 for unattended use, such as public key without a passphrase. Because user interaction is not possible, the server host key must be stored on disk on the client before unattended file transfers will succeed. More information and examples on storing remote server keys can be found in Server Authentication with Public Keys in File and Fetching Remote Server Keys. |
The sample scripts shown in this section can also be found in the
/opt/tectia/doc/zOS/SAMPLIB
directory.
This example (SCPGET
from SAMPLIB
) executes
scpg3 and copies a remote file (file.bin
)
into a data set (//'USER.TEST.BINFILE'
). If the data set does
not exist, it is created with default values recfm VB
and lrecl
1024
.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPGET EXEC PGM=BPXBATSL,REGION=0M //STDPARM DD * PGM /opt/tectia/bin/scpg3 user@remote:file.bin //'USER.TEST.BINFILE' //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //
In this example (SCPPUT1
from SAMPLIB
),
scpg3 is executed to copy a data set to a remote file
(test.list
), converting the code set from IBM-1047 to
ISO8859-1 and records to CR-LF delimited lines.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPPUT1 EXEC PGM=BPXBATSL,REGION=0M,TIME=NOLIMIT //STDPARM DD * PGM /opt/tectia/bin/scpg3 /ftadv:C=ISO8859-1,D=IBM-1047,I=DOS,J=MVS//__HLQ.TEST.LIST user@remote:test.list //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //
In this example (SCPPUT
from SAMPLIB
),
scpg3 is executed to copy a data set assigned to DD
LIST
to a remote file (test.list
), performing code
set translation via the 'TCPIP.STANDARD.TCPXLBIN'
translate table.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPPUT EXEC PGM=BPXBATSL,REGION=0M,TIME=NOLIMIT //STDPARM DD * PGM /opt/tectia/bin/scpg3 /ftadv:E=STANDARD,A=___TCPIP.%T.TCPXLBIN,F=LINE///DD:LIST user@remote:test.list //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //LIST DD DSN=&SYSUID..TEST.LIST,DISP=SHR //
In this example (SCPGET2
from SAMPLIB
), a
remote file (testfile
) is copied into a pre-allocated data set,
assigned to DD TEST
.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPGET2 EXEC PGM=BPXBATSL,REGION=0M //STDPARM DD * PGM /opt/tectia/bin/scpg3 user@remote:testfile //DD:TEST //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //TEST DD DSN=&SYSUID..TEST,DISP=(NEW,CATLG), // VOL=SER=ZZSYS1,SPACE=(TRK,(2,2)), // DCB=(RECFM=VB,LRECL=1024,BLKSIZE=27998) //
In this example (SCPGET3
from SAMPLIB
), a
remote Unix ASCII file (jcl.txt
) is copied to mainframe into a PDS
member using
lrecl 80
and recfm FB
, creating the PDS if it does not exist.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPGET3 EXEC PGM=BPXBATSL,REGION=0M //STDPARM DD * PGM /opt/tectia/bin/scpg3 user@remote:jcl.txt /ftadv:C=ISO8859-1,D=IBM-1047,FI=80,DIRSZ=10///'USER.JCL(JCL1)' //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //
In this example (SCPGET3W
from SAMPLIB
), a
remote ASCII CRLF (Windows/DOS) file (jcl.txt
) is copied to
mainframe into a PDS member using lrecl 80
and recfm FB
,
creating the PDS if it does not exist.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SCPGT3W EXEC PGM=BPXBATSL,REGION=0M //STDPARM DD * PGM /opt/tectia/bin/scpg3 user@remote:jcl.txt /ftadv:C=ISO8859-1,D=IBM-1047,I=DOS,J=MVS,FI=80,M=10///'USER.JCL(JCL1)' //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD DUMMY //
The sftpg3 file transfer application can be run in batch mode for non-interactive file transfers.
In this example (SFTPBAT
from SAMPLIB
),
sftpg3 is run in batch mode to copy a remote ASCII file
(jcl.txt
) into a PDS member using lrecl 80
and recfm FB
. If the PDS does not exist, it will be created.
The stdout and stderr message files are printed to SYSOUT
. Required
environment variables are supplied in SSHENV
via STDENV DD
.
Modify the DD statement according to your requirements.
//SFTP EXEC PGM=BPXBATSL,REGION=0M //STDPARM DD * PGM /opt/tectia/bin/sftpg3 -B //DD:STDIN user@remote //STDENV DD DSN=SSZ.SRVR6410.PARMLIB(SSHENV),DISP=SHR //STDOUT DD SYSOUT=* //STDERR DD SYSOUT=* //STDIN DD * sget jcl.txt \ /ftadv:C=ISO8859-1,D=IBM-1047,FI=80,DIRSZ=10///'USER.JCL(JCL1)' ls //'USER.JCL' //
In this example (SFTP
from SAMPLIB
),
sftpg3 is run in batch mode (with the -B
option).
Since it is not possible to enter a password, we use public-key authentication
with no passphrase for the private key.
sftpg3 returns the highest error code as the return code from the run. BPXBATSL multiplies this by 256 and returns the product as the step's condition code.
Using the ls command may cause non-zero error codes, for example if a referenced data set is in use in another address space. Run listings in separate steps if it is important to get the proper condition codes from file transfers.
The stdout and stderr message files are printed combined to SYSOUT
.
Required environment variables are supplied in SSHENV
via STDENV
DD
. Modify the DD statement according to your requirements.