IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Issue FTP PUT statement without replacing existing file


IBM Mainframe Forums -> All Other Mainframe Topics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Fri Jun 22, 2012 11:56 am
Reply with quote

Hi,
Is there any way we can issue an FTP PUT command so that this command fails when the file is already present on the server and not replaces it?

I can't do a DIR/GET for the file because the server seems to be meant only for PUTs, and fails evertime when we issue a DIR/GET with a 451 File not found error even though there's no file on server, which is wierdly sad.

The only way out is to use a variant of PUT so that it ensures it fails if the file's already there and places the file if there's no file..

Note. The file has a particular naming convention, and I can't use DATE or Timestamp to workaround icon_sad.gif
Back to top
View user's profile Send private message
vasanthz

Global Moderator


Joined: 28 Aug 2007
Posts: 1742
Location: Tirupur, India

PostPosted: Fri Jun 22, 2012 12:39 pm
Reply with quote

Hello,
Quote:
Is there any way we can issue an FTP PUT command so that this command fails when the file is already present on the server and not replaces it?

'FTP PUT' will replace the destination file blindly. I think this cannot be changed.

FTP GET has a REPLACE option but im afraid it won't be of any use to you in this scenario.
Back to top
View user's profile Send private message
bodatrinadh

Active User


Joined: 05 Jan 2007
Posts: 101
Location: chennai (India)

PostPosted: Fri Jun 22, 2012 3:08 pm
Reply with quote

Hi Vishwamurthy,

Manually login to the server and rename the existing file. Then run your FTP job.

Thanks
-3nadh
Back to top
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Fri Jun 22, 2012 3:14 pm
Reply with quote

i think what you mentioned should help, although there's a requirement which says if the older file is present, it means that the previous instance of the process din' run. So if that will run, it should pick the renamed file and not the current file, which i'm afraid cannot happen..
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Jun 22, 2012 5:18 pm
Reply with quote

RFC 959 indicates the STOR command, which is the official name for the PUT command, replaces an existing file. Unless your implementation of FTP is not standard, there is no way to change this behavior -- if the file does not exist, it is created; if the file does exist, it is replaced.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Jun 22, 2012 6:51 pm
Reply with quote

Hello,

Suggest you work with the network and/or server sujpport people and find out Why you cannot issue the DIR command. . .
Back to top
View user's profile Send private message
Vishwamurthy

New User


Joined: 11 Mar 2008
Posts: 57
Location: India

PostPosted: Tue Jun 26, 2012 1:33 pm
Reply with quote

We're thinking of this:
File01 for the first run
File02 for the second and so on..
This should help them pick the right file for the right process based on the number at the end..

Thanks guys, this can be closed now..
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Tue Jun 26, 2012 10:08 pm
Reply with quote

Hello,

If someone has to "pick", sometmes they will pick incorrectly. . .

Why is the missing run not an issue?

Someone still needs to determine why the DIR cannot be done.

The issue can be "closed" (i.e. if no one else replies, it is closed icon_smile.gif ), but there are still issues that need to be resolved.

If this approach (getting around problems rather than addressing them) has been used every time something is amiss, the entire environment is probably a 'time bomb" that may completely destroy itself.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> All Other Mainframe Topics

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Replacing 'YYMMDD' with date, varying... SYNCSORT 3
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top