PDA

View Full Version : scipt to sftp from one server to another


lucky4u27
2011-09-07, 07:45
HI all

I need a script that would take the file from a mainframe to another server.Presently i am using a ndm but i am not knowing what the changes would be required to change to sftp.

i have given the script i use to do using ndm please mention me as what all do i need to change to change it to sftp

submit copyfile process snode=NDM.ab snodeid=(cd,ef) class=1
stepa copy from (file=gh.ij.kl(0)
disp=(SHR,KEEP)
sysopts="mgmtclas=SLOB,dataclas=SIZE1"
snode )

to (file=/u/scripts/kl.$1
sysopts="datatype=text:"
pnode
)
stepb copy from (file=gh.ij.mn(0)
disp=(SHR,KEEP)
sysopts="mgmtclas=SLOB,dataclas=SIZE1"
snode )

to (file=/u/scripts/mn.$1
sysopts="datatype=text:"
pnode
)
pend ;


Can you please provide some code that would be helpful

chucker
2011-09-07, 07:56
Since you PM'd me:

I'm not even sure what NDM is, nor am I familiar with this script format. What sort of OS is this? What file transfer mechanism does this currently employ?

lucky4u27
2011-09-07, 08:00
Since you PM'd me:

I'm not even sure what NDM is, nor am I familiar with this script format. What sort of OS is this? What file transfer mechanism does this currently employ?

Hi thanks for looking into my thread

actually this a unix script which uses ndm and does file transfer from one server to another i need to change it to sftp so i wanted to know what would be the changes.

lucky4u27
2011-09-07, 08:04
Since you PM'd me:

I'm not even sure what NDM is, nor am I familiar with this script format. What sort of OS is this? What file transfer mechanism does this currently employ?

hi thank you for looking into my thread actually this is a unix script that does a file transfer from one server to another .currently i am using ndm but now i need to change to sftp so i am looking for some example or changes in the present script

709
2011-09-08, 18:26
I think s/he may have PM'd a lot of people, since I'm more known for my technical ability to distinguish the nuances between "fuck" "fucking" and "motherfucker" - so a PM about a "scipt" to me isn't going to do that much good.

Though I looked at your code and I'd consider trying this:

submit copyfile process snode=NDM.ab snodeid=(cd,ef) class=1
stepa copy from (file=gh.ij.kl(0)
disp=(SHR,KEEP)
sysopts="mgmtclas=SLOB,dataclas=SIZE1"
snode )

to (file=/u/scripts/kl.$1
sysopts="datatype=text:"
pnode
)
stepb copy from (file=gh.ij.mn(0)
disp=(SHR,KEEP)
sysopts="mgmtclas=SLOB,dataclas=SIZE1"
snode )

to (file=/u/scripts/mn.$1
sysopts="datatype=text:"
pnode
)
pend ; I have no fucking idea about what the fuck you're talking about motherfucker

Ryan
2011-09-08, 18:31
If they’re both Unix systems, they both probably have bash. Rather than using SFTP I’d see if you can use SCP (secure copy) instead, as that would just be a one-liner like:

scp /path/to/local/file user@remoteserver.domain.net:/path/to/remote/file

Do it as a bash script and just use variable substitution to fill in the right parameters for scp.