On Wed, Nov 30, 2016 at 11:14 PM, venkat kulkarni <
venkatkulkarn...@gmail.com> wrote:

> Do anybody have sample batch job to transfer data using sftp.
>
> Currently we using FTP in batch job PGM but not sure what program we should
> use for sftp and format of JCL to transfer  sequential and PDs datasets.
>
> Thnaks
>
>
​I'll avoid all the advice that you've been given about Co:Z from
Dovetailed Technologies (although I totally agree with it). I will assume
that you only have "normal" IBM supplied software and that the remote end
has a regular SSH server running. What I am unsure of is whether you
actually want to use "sftp" or if "scp" would be acceptable. So I will give
examples of both to allow you to choose which you prefer. The JCL will be
identical. In fact, I will show how I would do both transfers, first using
"sftp" and secondly using "scp"

//JOBNAME JOB ACCT,NAME,CLASS=A,MSGCLASS=H,
// NOTIFY=&SYSUID
//SFTP     EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD   SYSOUT=*
//SYSEXEC  DD   DISP=SHR,DSN=SYS1.SBPXEXEC (MAY BE DIFFERENT)
//SYSTSIN  DD   *
OPUT 'SOME.DATA.SET.NAME' '/tmp/SOME.FILE.NAME'
OSHELL { echo 'password'; +
         echo 'cd /tmp'; +
         echo 'ascii'; +
         echo 'put /tmp/SOME.FILE.NAME'; } | +
       sftp -v use...@remote.ssh.server
/*
//* CHANGE password TO ACTUAL PASSWORD
//* CHANGE cd COMMAND TO ACTUAL REMOTE DIRECTORY
//* REMOVE ascii LINE FOR BINARY TRANSFER
//* CHANGE userid TO REMOTE USER'S ID
//* CHANGE remote.ssh.server TO ACTUAL DNS NAME/IP ADDR
//SFTP     EXEC PGM=IKJEFT01,REGION=0M
//SYSTSPRT DD   SYSOUT=*
//SYSEXEC  DD   DISP=SHR,DSN=SYS1.SBPXEXEC (MAY BE DIFFERENT)
//SYSTSIN  DD   *
OPUT 'SOME.DATA.SET.NAME' '/tmp/SOME.FILE.NAME'
OSHELL echo 'password'; +
       scp /tmp/SOME.FILE.NAME +
       use...@remote.ssh.server:-
/tmp/SOME.UNIXFILE.NAME
/*
//* CHANGE password TO ACTUAL PASSWORD
//* CHANGE userid TO ACTUAL REMOTE USER ID
//* CHANGE remote.ssh.server TO ACTUAL DNS NAME/IP ADDR
//* !!!! CRITICAL !!!!
//* Note that scp command is spread over 3 lines due to
//* length of SYSTSIN input line. TSO will concatenate
//* them together into one logical line. IT IS CRITICAL
//* that you notice that I put the output file name
//* (/tmp/SOME.UNIXFILE.NAME) on its own line
//* IT IS CRITICAL that this start in column 1.
//* IT IS ALSO CRITICAL that the previous line
//* end in a dash instead of a plus and that the dash
//* is _IMMEDIATELY_ after the colon. This is to
//* force TSO to concatenate all these characters together
//* without any spaces, which would destroy the UNIX
//* command line.
//
​







-- 
Heisenberg may have been here.

Unicode: http://xkcd.com/1726/

Maranatha! <><
John McKown

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to