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?
write ls -l output straight to dataset
Re: write ls -l output straight to dataset
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:
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
//
Re: write ls -l output straight to dataset
thankyou that has worked just fine.
Re: write ls -l output straight to dataset
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?
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?
Re: write ls -l output straight to dataset
The FSUM7351 indicates that todsn is not in your path