Operating System - HP-UX
1820390 Members
3548 Online
109623 Solutions
New Discussion юеВ

How to FTP to UNIX file.yyyymmdd

 
SOLVED
Go to solution
Vlad_11
Frequent Advisor

How to FTP to UNIX file.yyyymmdd

Hi, is there any way to manipulate file name that FTP to UNIX from let say MVS. I need somehow allocate each time file with current date . MVS control card should be static, and I can't do anything about it. Last hope that I can inqure UNIX and append date to file.

My FTP card looks like this:
=================================
10.132.131.257 (exit=08
ANONYMOUS
PASS@SOMETHING.COM
LOCSITE NOTRAIL
put 'GLOBAL.SOV.NDM(0)' +
/export/pub/blacksheet
quit
/*
================================
Thansk to all.
Mario
beer or not beer
4 REPLIES 4
Sridhar Bhaskarla
Honored Contributor
Solution

Re: How to FTP to UNIX file.yyyymmdd

Hi Mario,

I am not sure there is..

You can probably setup a cronjob that will rename the file everytime it finds it.. One of the practices I have seen is that the ftp client uploads the datafiles and an index file containing the list of the datafiles. On the ftp server, a cronjob runs every n minutes, looks for the index file and renames the files under index file to the desired format..

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Cheryl Griffin
Honored Contributor

Re: How to FTP to UNIX file.yyyymmdd

You may have to escape to a shell and manipulate the date by hand. The date would be similar to the format:
`date +'%m%d%H%M'`
"Downtime is a Crime."
Bill Hassell
Honored Contributor

Re: How to FTP to UNIX file.yyyymmdd

ftp does not have any connection to shell tools or processes so the task would have to be scripted on the UNIX side. You can use a 'here' document to batch ftp and inside the ftp command list, you can place variables that are preset with the values you need. In ftp, there are two parameters for put and get, the local name and the remote name. Most users just use one name with the default action in put and get to set the second value to the first.

So on the UNIX side, you cen use:

get SOME.MVS.FILENAME $MYLOCALNAME

where MYLOCALNAME is defined earlier in the script with:

MYLOCALNAME=$(date +'%Y%m%d')


Bill Hassell, sysadmin
A. Clay Stephenson
Acclaimed Contributor

Re: How to FTP to UNIX file.yyyymmdd

Do a search of the forums for "Net::FTP". There are many examples and I've posted several myself. FTP'ing under Perl scripts is very easy AND you can specify both the source file and its destination in the same command. Perl has all the functions you need to manipulate the file name as you get it.
If it ain't broke, I can fix that.