How to convert a dat file into ebcdic formate in UNIX shell scripting through sftp

I want to convert a dat file into ebcdic formate and I need to write that converted ebcdic file into mainframe server through sftp in my shell script.
Please help on this.
What need to do?
And please provide a sample code for this.