SFTP Mainframe to Unix - Problems trying to Append Files

Discussion of Co:Z sftp, a port of OpenSSH sftp for z/OS
Post Reply
lzvk25
Posts: 1
Joined: Wed Nov 17, 2010 1:19 pm

SFTP Mainframe to Unix - Problems trying to Append Files

Post by lzvk25 »

Please Help.

I currently need to convert 108 FTP job to SFTP jobs and all of them perform the appending of a file body to a header during the FTP process. So I am trying to find an equivalent since the "Append" command is not supported in SFTP. In my particular case, if I could perform a "cat" command, my problems would be solved.

This is the SFTP Parms (or //COZSFTP.STDIN ) Dataset :

Code: Select all

. $CONFIG
#Get Password from Password File
export PASSWD_DSN='//DWTEST.ABC00011.CONTROL(ABCFTPL1)'
#Setup User@Remote Server Name
cozsftp user001@enterprise.local.server.com <<EOB
#Select Text or Binary
lzopts mode=text
#Move Data from MainFrame to Distributed Server
cd /tmp
pwd
put //ABC0001.MAIN.FRAME.FILE.HEADREC CU13H
put //ABC0001.MAIN.FRAME.FILE.DATAREC CU13D
!cat '/tmp/CU13H' '/tmp/CU13D' > '/tmp/CU13F'
rename 'CU13F' 'CU13_20100927_231103.#finished#'
EOB
And I am able to upload the files CU13H and CU13D, but when it comes to concatenate both and build CU13F (cat step), it tells me : "FSUM7343 cannot open "/tmp/CU13F" for output: EDC5129I No such file or directory", and obviously, the step fails.

So, please tell me, what am I doing wrong ?

Any help will be appreciated, just one thing to please keep in mind, I am a mainframer, so please, do not asume I know everything about Unix.

Thanks
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Post by dovetail »

Co:Z SFTP is based on OpenSSH 5.0p1, which doesn't support "append", but even it id did - your remote SFTP server would have to support it.

In your example, the "cat" command is executed locally, which is why it is failing.

It looks like you are trying to concatenate two local datasets to a remote file. One way to do this would be to transfer from a concatenated local DD name:

Code: Select all

//STDIN DD *
. $CONFIG 
#Get Password from Password File 
export PASSWD_DSN='//DWTEST.ABC00011.CONTROL(ABCFTPL1)' 
#Setup User@Remote Server Name 
cozsftp user001@enterprise.local.server.com <<EOB 
#Select Text or Binary 
lzopts mode=text 
#Move Data from MainFrame to Distributed Server 
cd /tmp 
pwd 
put //DD:INFILE CU13F
rename CU13F 'CU13_20100927_231103.#finished#' 
EOB 
/*
//INFILE DD DISP=SHR,DSN=ABC0001.MAIN.FRAME.FILE.HEADREC
//            DD DISP=SHR,DSN=ABC0001.MAIN.FRAME.FILE.DATAREC
//
atrivino
Posts: 17
Joined: Wed Jul 13, 2011 9:28 am

Re: SFTP Mainframe to Unix - Problems trying to Append Files

Post by atrivino »

I noticed the original post and response dates back to 2010. I was curious if this is still the case today that SFTP does not support 'Append' command?
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: SFTP Mainframe to Unix - Problems trying to Append Files

Post by dovetail »

With Co:Z SFTP server, a remote sftp client can append to a data set using:

ls /+disp=mod

is that what you are asking about?
atrivino
Posts: 17
Joined: Wed Jul 13, 2011 9:28 am

Re: SFTP Mainframe to Unix - Problems trying to Append Files

Post by atrivino »

It is in regards to append two files into one onto a remote server from the mainframe (client). Does sftp still support //DD:INFILE ? An end user attempted the forum recommendation but is failing. The end user DD are pointing to two gdg datasets:

//INFILE DD DISP=SHR,DSN=XXXXXXX(-1)
// DD DISP=SHR,DSN=XXXXXXX(0)

control card:
cd /PROD/DOWNLOAD/IRR
put //DD:INFILE xxxxxx.csv

error message:
stat //DD:INFILE: not found
dovetail
Site Admin
Posts: 2022
Joined: Thu Jul 29, 2004 12:12 pm

Re: SFTP Mainframe to Unix - Problems trying to Append Files

Post by dovetail »

Yes, this should work.
One possibility is that you have:

export _BPX_SHAREAS=NO

in your /etc/profile or .profile

add this line to the beginning of your script to see:

env

If this doesn't solve the problem, them please open a support ticket since your company has an ELA agreement.
Post Reply