UNIX sftp from mainframe


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers UNIX sftp from mainframe
# 1  
Old 08-11-2009
Tools UNIX sftp from mainframe

I have the following UNIX script which copies a file from a UNIX server in Canada to a UNIX server in the UK.

LOG=/data/proj/sftp/canada.log
DAT=`date "+%d/%m/%y %H:%M"`
HOMEDIR=/data/proj/sftp
TGTFILE=P_DATA.csv
cd $HOMEDIR
echo "\nStarting retrieval of Canadian Data at $DAT" >> $LOG

# move old copy of file
if [ -f $TGTFILE ]
then
mv $TGTFILE $TGTFILE.prev
echo "Existing $TGTFILE renamed with .prev suffix" >> $LOG
fi

# get new file using sftp
echo "Using sftp to connect to ftppora1@sxmq1014.pftg.ca" >> $LOG
sftp -b $HOMEDIR/ftpcmd -oPort=32 ftppora1@sxmq1014.pftg.ca 2>>$LOG 1>>$LOG

# check file retrived successfully
if [ -f $TGTFILE ]
then
echo "$TGTFILE retrieved successfully" >> $LOG
else
echo "*** Error retriving data ***" >> $LOG
exit 1
fi

exit 0


At present, I can run this script by logging onto the server as user xxxxx with password zzzzzz.

I want to automate this process - and wish to kick off the above script from JCL on the mainframe. I've been advised that an OPC job using TWS can be used, as this enables a remote ID and password to be specified on the appropriate job step. Anyone have any example JCL to do this?
# 2  
Old 08-11-2009
I have an iSeries magazine that went into this from about a year ago I think. I'll dig it up and see if it has something. I realize MF and iSeries aren't exactly the same but some of it fairly similar and might be able to get you headed down the right path.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Can we execute Mainframe JCL thru UNIX

Hi, can we execute mainframe jcl in Unix system. I want to run jcl in unix instead of mainframe. Thanks in advance. Please post in an adequate forum! (6 Replies)
Discussion started by: Rajeev Das
6 Replies

2. UNIX for Dummies Questions & Answers

Vb file from UNIX to mainframe

Hi Everyone, Do I need to provide record length as Record length + 4 when I'm transferring a variable block files from unix to mainframe through ftp? For example, I have a file in unix (ebcidic converted) with maximum record length of 100. This works correctly, quote... (1 Reply)
Discussion started by: poova
1 Replies

3. UNIX for Dummies Questions & Answers

Sftp from UNIX to mainframe

Hi, I have many scripts where i have used sftp for file transfer from unix box to unix box.. Now that we have to sftp files from unix to mainframe, i would like to know if that is possible. I just tried in the same way i did from unix to unix, but i got the error as connection refused. Are... (2 Replies)
Discussion started by: dnat
2 Replies

4. Shell Programming and Scripting

Use sftp in scripts to transfer data from mainframe to Solaris

Hi, I have a situation where in we have created shell scripts to transfer data from/to mainframe and Solaris. The scripts uses ftp commands line commands(get or put) to perform the task. Now due to security reasons, ftp will not be allowed and sftp will be used. Can anyone let me know what is... (1 Reply)
Discussion started by: bornon2303
1 Replies

5. AIX

Problems with SSH/SFTP between AIX and Mainframe

Hi, I'm not sure if this has been solved in this forum already but please do help me out if possible. Basically, I've already setup a passwordless SSH connection between 2 AIX IDs (say ID-1 and ID-2) with a Mainframe server ID (say MVSID). I'm able to successfully do an SSH from the AIX server to... (1 Reply)
Discussion started by: sambeet
1 Replies

6. UNIX for Dummies Questions & Answers

Issue: SFTP via Mainframe using BPXBATCH

Hi, I am trying to execute sftp transfer via the bpxbatch utility. I am getting an exit status of 16. Any idea what this means ? I have searched almost everywhere but couldn't find the mention of status 16. Below is the log: debug1: Next authentication method: publickey. ... (0 Replies)
Discussion started by: ali_asgar
0 Replies

7. UNIX and Linux Applications

ftp from unix to Mainframe

suppose i have a file named xyz(-1) and i have to transfer(ftp) it on a Mainframe from unix,how should i do it as whenever i try to do so it says use MVS naming conventions (1 Reply)
Discussion started by: ashishabhishek
1 Replies

8. HP-UX

ftp from unix to mainframe

hi suppose i have a file named xyz(-1) and i have to transfer(ftp) it on a Mainframe from unix,how should i do it as whenever i try to do so it says use MVS naming conventions (1 Reply)
Discussion started by: ashishabhishek
1 Replies

9. UNIX for Dummies Questions & Answers

USS (unix) on the Mainframe

Does anyone work with USS on an IBM Mainframe computer on this msg board? (2 Replies)
Discussion started by: Javagate
2 Replies

10. Post Here to Contact Site Administrators and Moderators

USS (unix) on the Mainframe

am wanting to know if the board is worth my time and effort since I work with USS (Unix System Services) on a Mainframe computer. If there are others who use USS on the Mainframe this will be helpfull. I dont want to spend my time racking up the number of posts I have nor should anyone else. ... (2 Replies)
Discussion started by: Javagate
2 Replies
Login or Register to Ask a Question