Your browser does not allow this site to store cookies and other data. Some functionality on this site may not work without them. See Privacy Policy for details on how we would use cookies.

SSH

File Transfer Example Using scpg3

This example uses the SCPGET JCL that can be found from SAMPLIB. SAMPLIB contains also other scpg3 and sftpg3 non-interactive file transfer examples.

This example executes scpg3 and copies a remote file textfile.txt into a data set //'USERID.TEST.TEXTFILE'. If the data set does not exist, it is created with default values recfm VB and lrecl 1024.

//SCPGET EXEC PGM=IKJEFT1A,
//       DYNAMNBR=75,
//       TIME=1440,
//       REGION=6M
//SYSPRINT DD SYSOUT=*
//SYSTSPRT DD SYSOUT=*
//SYSTERM DD DUMMY
//STDOUT  DD PATH='/tmp/&SYSUID.-SCPGET.out',
//       PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
//       PATHMODE=(SIRUSR,SIWUSR)
//STDERR  DD PATH='/tmp/&SYSUID.-SCPGET.err',
//       PATHOPTS=(OWRONLY,OCREAT,OTRUNC),
//       PATHMODE=(SIRUSR,SIWUSR)
//STDENV  DD DSN=&SYSUID..SSZ.SRVR&versionshort;.PARMLIB(SSHENV),
//       DISP=SHR
//SYSTSIN DD *
 BPXBATCH PGM /opt/tectia/bin/scpg3 +
    user1@remote_host:textfile.txt +
    //'USERID.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.-SCPGET.out',
//       PATHOPTS=(ORDONLY),
//       PATHDISP=(DELETE,KEEP)
//STDERR  DD PATH='/tmp/&SYSUID.-SCPGET.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
/*

===AUTO_SCHEMA_MARKUP===