Using sftp from one server to other server

Which files, from where, should end up where?

You already have lots and lots of them, stop begging for more. You just don't have the paths you need to use them.

I'm not playing dumb.

I'm not punishing you for something.

Actually, I'm about as puzzled as you are. :confused:

That script of yours isn't much help. There's no UNIX file paths in there. Maybe there's more in whatever system was running that program, since I doubt it ran itself -- it seems to have depended on something larger.

That only might be the file name, it seems dubious. It certainly doesn't tell you or us where it is. Sorry.

Do you have shell access to the computer in question? Can you ssh in in a terminal, and try to find the file from there?

The script that you require is only one line long.
The only thing that will make it longer, is if the user_id is variable, or you want to test for success or failure of the copy.
The input to the script is two lines long.
This can be literals unless the file name(s) are variable
If you use sftp and not scp, then you must configure ssh to use stored keys instead of passwords if you wish to run the script unattended (background, or as a scheduled task).
Since you are unfamiliar with unix, why don't you push the file from the mainframe to the unix system, then all you need to know about unix is the destination file name and directory, and a valid userid and password, with write permissions to the destination directory.

thank you i will try using stored keys and configure ssh because i need to create an automated script

you mentioned about pushing the file from mainframe to unix system how to do that i need just the logic

---------- Post updated at 05:22 PM ---------- Previous update was at 05:08 PM ----------

DONT TALK TO MUCH IF U WISH TO ANSWERE ON MY QUESTION THEN DO IT OR ELSE LEAVE IT IF I START TALKING U WONT BE ABLE OPEN UR MOUTH :slight_smile:

[quote=
that script of yours isn't much help. there's no unix file paths in there. maybe there's more in whatever system was running that program, since i doubt it ran itself -- it seems to have depended on something larger. that only might be the file name, it seems dubious. it certainly doesn't tell you or us where it is. sorry.

do you have shell access to the computer in question? can you ssh in in a terminal, and try to find the file from there?[/quote]

FORGET ABOUT MY SCRIPT WHATEVER I GAVE LEAVE IT

YOU TOLD TO USE SCP I WANTED TO KNOW AS THE FILE WHICH HAS TO BE TRANSFERRED TO MY UNIX SERVER EXISTS IN MAINFRAMES SERVER.

So will scp work for file transfer between mainframe and unix server

As the last 4 pages of discussion has been trying to tell you -- we need information from you to do that. Sure, I can ignore your script, and have nothing to go on at all...

You've got examples good enough for you to plug in the filename and go. If you want us to do that, we need to know it. You don't know where the file actually is anyway and I can't tell you, because my crystal ball has been stuck in maintenance for years.

Once you do, it's a simple matter of copy-pasting it into one of the things given to you in this thread, vi myprogram ; chmod +x myprogram ; ./myprogram.

If you know that sftp will, then of course it will: They use the exact same protocol. They talk to the same daemon.

Do you know that sftp will work? This might be a wild goose chase -- we have no idea what your mainframe is. It might be something strange, by the sound of it. Have you tried from a terminal, for instance?

We don't know what your UNIX is, for that matter! Both would let us write more complete/working examples.

If you know for a fact that sftp will work, then we're nearly done. You can just put it into one of the examples given and do it.

---------- Post updated at 04:46 PM ---------- Previous update was at 04:28 PM ----------

Here is as complete an example as can be written without knowing what your systems are. It might not be quite right, but I get the feeling I might be heading home sooner than I can find out what you haven't told us yet.

1) Create a file. If you have vi, 'vi filename'. If you have nano, 'nano filename'. If you have emacs, 'emacs filename'. If you have pico, 'pico filename'. And so forth. We don't know your system or text editor yet.

2) The file should look like this:

#!/bin/sh
# Replace /path/to/remote/file with whatever your remote file actually is.
sftp username@host <<EOF
get /path/to/remote/file
EOF

3) Set it executable: chmod +x ./myprogram
4)Run it: ./myprogram
5) Tell us if it didn't work: In detail, not "IT DIDNT WORK".

ANSWERE1 ::wall:THE FILE EXISTS IN THE MAINFRAME SERVER IN THE FOLLOWING LOCATION

CAM.NC.CUR(0)
if this too does not help let me know as i cant give you the orginal path because of security reasons so try to understand

ANSWERE 2:YES I KNOW 100% THAT SFTP CAN BE USED TO DO THE TRANSFER FILE .
CAN YOU TELL ME HOW TO CREATE A BATCH JOB BY USING YOUR SCP COMMAND

---------- Post updated at 05:52 PM ---------- Previous update was at 05:49 PM ----------

I FOUND SOME INFORMATION ON THIS I SHARING THE LINK PLEASE TELL ME IF THIS WILL WORK
https://libsys.kctcs.edu/stapleton/file-xfer/scripting.html

Please stop screaming at folks. You're supposed to be some sort of professional, yes?

Lots and lots and lots of questions in my last post you didn't answer. What kind of computer you're using is hardly proprietary information...

That's not any sort of file path that I recognize. But if you say so. Go ahead and try it.

There's other things you could've answered that wouldn't have given away proprietary information. Like, what kind of system that mainframe is. 'CAM.NC.CUR(0)' makes no sense in UNIX, and probably won't make any sense to SFTP, but knowing what the system is may help us figure out what it actually means.

Furthermore. I ask whether you're positive you know sftp works, not because I think you're an idiot, and not because I like the rush of wind of you screaming at me for having the temerity to ask an obvious question, but because in threads about mainframe systems before, they've often used ftps, not sftp. Not the same thing at all.

I can only hope you missed the update I added and aren't actually asking me to feed the example to you keystroke by keystroke...

you code worked for me thanks a lot