ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Howto Rename Filename after creation of file thru FileOutput

Post new topic  Reply to topic Goto page 1, 2  Next
 Howto Rename Filename after creation of file thru FileOutput « View previous topic :: View next topic » 
Author Message
saddankula
PostPosted: Fri Aug 19, 2016 5:01 am    Post subject: Howto Rename Filename after creation of file thru FileOutput Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

Hi All,

I need your suggestion for changing the file name after creation of file Through File Output node.

Scenario: Through File Output node I created file with "Localdata.xml" and I appended the records into that file . After appending I need to change file name as " Localdata_Date.xml ".

Could any one pls provide suggestion how to rename the file name.
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Aug 19, 2016 5:08 am    Post subject: Re: Howto Rename Filename after creation of file thru FileOu Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

saddankula wrote:
Could any one pls provide suggestion how to rename the file name.


And you didn't create the file with the right name in the first place because.....?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
saddankula
PostPosted: Fri Aug 19, 2016 5:18 am    Post subject: Reply with quote

Acolyte

Joined: 27 Jun 2013
Posts: 51

is it possible to rename the file name in Esql coding ?
Back to top
View user's profile Send private message
Vitor
PostPosted: Fri Aug 19, 2016 5:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

saddankula wrote:
is it possible to rename the file name in Esql coding ?


Yes, as described in the InfoCenter.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paustin_ours
PostPosted: Mon Aug 22, 2016 4:47 am    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Quote:

And you didn't create the file with the right name in the first place because.....?


this is a valid request, many a times you want to write a file with a .temp at the end or a .x and then rename it after the file is completely written.

this helps in scenarios where you want to make sure no application accidentally consumes a partially written file.

we always ask applications that write files to our file input directory to write with a temporary name and then rename to actual names.

i dont think fileoutput node allows such a feature, does it?
Back to top
View user's profile Send private message Yahoo Messenger
mqjeff
PostPosted: Mon Aug 22, 2016 5:12 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

paustin_ours wrote:
Quote:

And you didn't create the file with the right name in the first place because.....?


this is a valid request, many a times you want to write a file with a .temp at the end or a .x and then rename it after the file is completely written.

this helps in scenarios where you want to make sure no application accidentally consumes a partially written file.

we always ask applications that write files to our file input directory to write with a temporary name and then rename to actual names.

i dont think fileoutput node allows such a feature, does it?


FileOutput node doesn't offer such a feature.

Because it handles it automatically for you.

But the problem you describe is exactly why you shouldn't use files to transfer data.
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Aug 22, 2016 6:32 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

paustin_ours wrote:
this is a valid request, many a times you want to write a file with a .temp at the end or a .x and then rename it after the file is completely written.

this helps in scenarios where you want to make sure no application accidentally consumes a partially written file.


No it's not a valid request.

To prevent an application accidentally consuming a partially completed file the FileOutput node, by default, stages the file in the mqsitransit directory and only moves it to the output directory when the file is signaled to be complete by a message arriving on the FinishFile terminal of the FileOutput node.

I understand that in other systems (e.g. Java ) it's a perfectly acceptable paradigm to rename files as you describe. It's the alternative to a staging directory.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Aug 22, 2016 6:34 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Vitor wrote:
I understand that in other systems (e.g. Java ) it's a perfectly acceptable paradigm to rename files as you describe. It's the alternative to a staging directory.


Either method still says "I shouldn't be using files to transfer data", because either method says "I have to muck about with fixing things that I shouldn't have to fix". You wouldn't expect to post data to a temporary URL and then send another HTTP request to move the data to a new URL, would you?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon Aug 22, 2016 6:50 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

mqjeff wrote:
Vitor wrote:
I understand that in other systems (e.g. Java ) it's a perfectly acceptable paradigm to rename files as you describe. It's the alternative to a staging directory.


Either method still says "I shouldn't be using files to transfer data", because either method says "I have to muck about with fixing things that I shouldn't have to fix". You wouldn't expect to post data to a temporary URL and then send another HTTP request to move the data to a new URL, would you?




But it's an imperfect universe, and files are like COBOL. People have been predicting the death of both for years but no-one's actually come up with the appropriate wooden stake / silver bullet
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
adubya
PostPosted: Mon Aug 22, 2016 11:49 am    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

saddankula wrote:
is it possible to rename the file name in Esql coding ?


Sort answer is no. But you could write a Java class which did the rename and call this from ESQL if you reallly want to do this.
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
smdavies99
PostPosted: Mon Aug 22, 2016 12:14 pm    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

adubya wrote:
saddankula wrote:
is it possible to rename the file name in Esql coding ?


Sort answer is no. But you could write a Java class which did the rename and call this from ESQL if you reallly want to do this.


And doing so could get yourself into a whole heap of trouble unless you understand the details of the underlying filesystems locking system.

As has been saidm for local files this renaming is done for you under the covers.
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
adubya
PostPosted: Mon Aug 22, 2016 12:20 pm    Post subject: Reply with quote

Partisan

Joined: 25 Aug 2011
Posts: 377
Location: GU12, UK

smdavies99 wrote:
adubya wrote:
saddankula wrote:
is it possible to rename the file name in Esql coding ?


Sort answer is no. But you could write a Java class which did the rename and call this from ESQL if you reallly want to do this.


And doing so could get yourself into a whole heap of trouble unless you understand the details of the underlying filesystems locking system.

As has been saidm for local files this renaming is done for you under the covers.


If you stage the output file in mqsitransit and then once the file output node has done it's thing and moved the file to the output dir then the file is unlocked and available for pilfering isn't it ?
_________________
Independent Middleware Consultant
andy@knownentity.com
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Mon Aug 22, 2016 12:28 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

adubya wrote:
If you stage the output file in mqsitransit and then once the file output node has done it's thing and moved the file to the output dir then the file is unlocked and available for pilfering isn't it ?


And you've created an entirely unnecessary Java component that you then need to maintain for no reason at all.

There are 2 ways to handle the incomplete file problem: stage it in a different directory or name it a temporary name then rename it when you're finished. If you stage the file in the mqsitransit directory then there's no need to rename it for that purpose, only because you've used the wrong name & you can avoid that with the method I laid out rather than a piece of Java.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
paustin_ours
PostPosted: Mon Aug 22, 2016 5:56 pm    Post subject: Reply with quote

Yatiri

Joined: 19 May 2004
Posts: 667
Location: columbus,oh

Quote:
And doing so could get yourself into a whole heap of trouble unless you understand the details of the underlying filesystems locking system.


we do this a whole lot in our code.

we call perl from java from esql

we call c from java from esql

IBM has looked our code many many times and never raised concern even once. Actually we have been encouraged and told that other customers do the same.
Back to top
View user's profile Send private message Yahoo Messenger
mqjeff
PostPosted: Tue Aug 23, 2016 3:48 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Which "IBM"?

Broker L2 support? The PMR process will only complain about your code if it is shown to be the problem behind the PMR.

A team of GBS consultants? They're not paid to approve your code, they're paid to do whatever their contract says.

A Software services consultant? They will tell you that this is not a recommended approach for dealing with files, but if you complain that "we do it all the time and it works fine", then almost certainly they won't push the issue.

Calling Perl and C and etc. from ESQL is fine and dandy. Unless it's doing things that are already handled directly by a Broker built-in node. Then it's a waste of time and coding. So, not a recommended practice... (at least by me).

Again, when it comes to exchanging data using files, the FileOutput node will handle everything you need to protect the file from being processed before it's complete. So writing your own code to do it is, as I said, a waste of time and code.

And in general, exchanging data using files is a practice that has not been a good idea since anything else was available - roughly around the time of the invention and availability of HTTP servers. Which was, what? 1992?
_________________
chmod -R ugo-wx /
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Howto Rename Filename after creation of file thru FileOutput
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.