How to transmit a file from UNIX to Mainframe via SFTP ?

15 pts.
Mainframe FTP Program
Hi All, I'm working on a small SFTP scripting, where in we connect to an external vendor via SFTP to get a file (File is on UNIX box), and push the file to Mainframes. As per the company norms, we should be using SFTP to get/put any files with external servers. So I'm using SFTP to get the file, rename the file representing a mainframe file and push the same to Mainframes via FTP. Mainframe developer says that the file is coming with only one record of 80 length, where as there are many records expected. I did a couple of testing around this, and instead of FTP I did email the files and those seems to be correct. I also tried FTP in both the cases like pulling from external vendor and pushing to our internal mainframes, those are also correct. But the problem is when we do SFTP to get the file and FTP to push the file to Mainframe. I'm sure it has something to do with UNIX to Mainframe transmission but really not sure how to get around of this. FTP is not a recommended to get the file from external vendor, so I need to fix this at pushing end of the file to Mainframes. Any advice or guidance is highly appreciated. Thanks SK

Answer Wiki

Thanks. We'll let you know when a new response is added.

Hmm this sounds like something is interfering with your SFTP. What kind of a firewall are you running? Have you checked the log files that it is not truncating or altering your files? You mentioned that running FTP for the files in question did actually transmit the correct files and file sizes.

Ftp is not secure so your company won’t let you utilize it – but how about SCP? In Unix, you can use the scp command to copy files and directories securely between remote hosts without starting an FTP session or logging into the remote systems explicitly. The scp command uses SSH to transfer data, so it requires a password or passphrase for authentication. Unlike rcp or FTP, scp encrypts both the file and any passwords exchanged so that anyone snooping on the network can’t view them.

In general, the syntax for scp (as for cp) is:

scp [option…] source destination

where source and destination can each take the form:




See if this helps!


You could try using the sftp’s -v option, to increase verbosity. It could help on identifying the problem.

Just in case, I would also check the ssh config file to see if compression is enabled, and if so, try disabling it.

You could also use the -o option to play with different ssh options, to see if one of them helps.

Discuss This Question: 3  Replies

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.
  • LrnWithFn
    Hi KarlG, At this point using of SCP from UNIX is not an option, as it requires corporate intervention and they have their own priorities on this. I was advised to search for the solution with in SFTP zone running on Windows machine. I can put your suggestion forward to my company, but can't guarantee its implementation at this point. Do you think any usage of parameters in SFTP script to correct the problem?
    15 pointsBadges:
  • JohnRG
    From what I understand is that you have been able to successfully FTP and SFTP a file from the Unix box to your Windows PC. Have you looked at what the differences in the files are between the two methods you have used to retrieve the files?
    10 pointsBadges:
  • Giltjr
    When you ftp to the mainframe are you ftp'ing to a MVS file or to the Unix System Services? If ftp'ing to a MVS file did you issue the quote site command? Can you look at the file on the Windows box? Does it have CRLF or just LF as record terminators? If it has just LF, then you need to convert it to a DOS style file, that is terminated with CRLF.
    10 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.


Share this item with your network: