You cannot do it directly, you have to do a two step process.
Sending files to z/OS using SFTP
SFTP can send files to Unix Services Subsystem. It cannot send to data sets.
You can use commands like
- cd to change directory on the remote system
- lcd change directory on the local system
There is no command “bin” nor “quote…”.
Getting from a Unix Services file to a dataset.
You can use the cp command.
To copy a binary file to a dataset
For example as if you were using FTP with BIN; quote site cyl pri=1 sec=1 recfm=fb blksize=3200 lrecl=80; put mp1b.load.xmit ‘COLIN.MP1B.LOAD.XMIT’)
cp -W “seqparms=’RECFM=FB,SPACE=(500,100),LRECL=80,BLKSIZE=3200′” mp1b.load.xmit “//’COLIN.MP1B.LOAD.XMIT'”
Where the seqparms are in upper case. If they are in mixed case you get
FSUM6258 cannot open file “… “: EDC5121I Invalid argument.
I could then do TSO RECEIVE INDSN(‘COLIN.MP1B.LOAD.XMIT’).
To copy a text file to a data set
If you use SFTP to copy a text file to Unix Services, it gets sent in bin, and, on z/OS, looks like
ñÃ ÈÇÁ ËøÁÄÑÃÑÁÀ….
You can tag a file so Unix Services knows it is an ASCII file, using
chtag -tc ISO8859-1 aaa
This makes the file editable from Unix Services, but you cannot just use cp to copy and create a dataset, as above.
You can convert it from ASCII to EBCDIC using
iconv -f ISO8859-1 -t IBM-037 ascii_file > ebcdic-file
cp -W “seqparms=’RECFM=VB,SPACE=(CYL,(1,1)),LRECL=800,BLKSIZE=8000′” ebcdic-file “//’COLIN.EBCDFILE'”