SFTP in batch

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
Shady
Posts: 37
Joined: Wed Feb 24, 2010 10:50 pm

SFTP in batch

Post by Shady »

Just a quick question...
I want to use Co:Z SFTP Client in batch to transfer a whole PDS.
I sepearated the STDIN for Co:Z Batch so that I have a inline
STDIN and a concatenated DD:

Code: Select all

//STDIN        DD *                                              
USER="user"                                                     
PWDSN="hlq.hlq.llq(pw)"                                      
SERVER="server"                                                 
REMOTEFILE="//hlq.llq"                                   
LOCALFILE="//DD:DOWNLOAD"                                     
//             DD DSN=hlq.hlq.llq(COZSTDIN),DISP=SHR         
In the COZSTDIN (from last line in the code) I use my variables to set up the SFTP connection.

Code: Select all

lcd $LOCALFILE
cd $REMOTEFILE
mget *        
When I submit my job the output says

Code: Select all

Couldn't change local directory to "//DD:DOWNLOAD"
When I specify the $REMOTEFILE with the real DSN then it works.

Is there an alternate to transfer a whole PDS? Maybe it's to easy so that I don't find it..... :?:

It would't be a big problem when I have to specify the correct DD in the REMOTEFILE but it would be a nice add when there is an other way...
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

This doesn't work since Co:Z SFTP can't recognize a DD as a "directory" even though it is a PDS. This is probably something that we should look into as an enhancement.

To do this you would need to specify the local PDS's dsname. This could be passed into COZBATCH via a PARM from your PROC or JCL SET variable, so you could still customize it with JCL.
Shady
Posts: 37
Joined: Wed Feb 24, 2010 10:50 pm

Post by Shady »

Thanks for your answer.
So I have an other question to that...
I can't use unix like if-then-else-fi in the STDIN, can I?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

COZBATCH is just a utility that allows you to run the Unix shell in a batch address space. So you can use any shell script construct prior to running the "cozsftp" command, which is the actual OpenSSH sftp client.
Shady
Posts: 37
Joined: Wed Feb 24, 2010 10:50 pm

Post by Shady »

That's what I thought but I got an error and so I firstly asked you about COZBATCH...
I'll review my code...
Post Reply