Your browser does not allow storing cookies. We recommend enabling them.

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
/*


 

 
What to read next:

  • Reduce Secure Shell risk. Get to know the NIST 7966.



    The NISTIR 7966 guideline from the Computer Security Division of NIST is a direct call to action for organizations regardless of industry and is a mandate for the US Federal government.
    Download now
  • ISACA Practitioner Guide for SSH



    With contributions from practitioners, specialists and SSH.COM experts, the ISACA “SSH: Practitioner Considerations” guide is vital best practice from the compliance and audit community.
    Download now