write ls -l output straight to dataset

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
tsgb25
Posts: 8
Joined: Thu Feb 06, 2014 6:22 am

write ls -l output straight to dataset

Post by tsgb25 »

Hi,

From a mainframe I am logging onto a unix server using sftp and would like to write the contents of a directory straight to a dataset.

I am using the ls -l command to do this. The command is working just fine with sftp, but the contents always go to the SYSOUT dd.

So I can get it to work by specifying a dataset for the SYSOUT dd, but I am only interested in the output from the ls command so was just wondering if there is a way to only get this output into a seperate dataset?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: write ls -l output straight to dataset

Post by dovetail »

output from cozsftp commands is written to the Unix stdout stream.

The way that COZBATCH works, stdout is redirected to DD:STDOUT if it exists and otherwise to DD:SYSOUT.

You can also redirect the output of cozsftp to a file using "> file" or to to a DD/dataset by piping into a "todsn" command.

For example, assuming that you are using the sample Co:Z SFTP batch PROC and scripts, you could do something like this:

Code: Select all

//SFTPCONN EXEC PROC=SFTPPROC 
//SFTPIN DD * 
pwdsn="COZUSER.COZ.SAMPJCL(MYPW)" 
user=myuser 
host=myhost 
                                                          
. $script_dir/sftp_connect.sh <<EOB | todsn //DD:MYDD
ls -l
EOB
//
tsgb25
Posts: 8
Joined: Thu Feb 06, 2014 6:22 am

Re: write ls -l output straight to dataset

Post by tsgb25 »

thankyou that has worked just fine.
tsgb25
Posts: 8
Joined: Thu Feb 06, 2014 6:22 am

Re: write ls -l output straight to dataset

Post by tsgb25 »

We have upgraded to coz:sftp 3.51 from 2.3 and also z/OS 2.1 from z/os 1.13.
When we try and run the todsn //DD:CMDOUT in the stdin, this no longer we works - we get the following msg todsn: FSUM7351 not found .

Is there a way to get this to work in 3.51?
coz
Posts: 391
Joined: Fri Jul 30, 2004 5:29 pm

Re: write ls -l output straight to dataset

Post by coz »

The FSUM7351 indicates that todsn is not in your path
Post Reply