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 » How can I halt the creation of a batch file creation

Post new topic  Reply to topic Goto page 1, 2  Next
 How can I halt the creation of a batch file creation « View previous topic :: View next topic » 
Author Message
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:36 pm    Post subject: How can I halt the creation of a batch file creation Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

I am working on a flow that uses record by record writing to an output file and I want to "cancel" file creation when certain conditions are met (i.e. the count on the trailer record does not match the total records processed). When I throw an exception in the ESQL node connected to finish file terminal of the fileoutput node, it halts the flow, which is desired, however, it keeps the partially built file in the mqsitransit folder of the output directory. This would be OK, but if I drop the same file again for processing (with the same name), now it will append all of the "new" records to the partially built file and what I end up with is a huge mess of an XML file. Changing the file name on re-drop is not really a solution because it leaves room for human error if they don't know the process.

Is there any way to cause the file output node to "stop" building the output file and rollback what it has done (i.e. delete the file in mqsitransit)? I have not found much information about this in docs so I figured I would ask the experts. My next best solution is to call a shell script to delete the file out of the mqsitransit directory whenever this error is encountered, but this just doesn't seem like it should be the only way to handle this problem. Any ideas or workarounds?

Thanks in advance for your help.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 1:37 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

You didn't mention what version you on. WMB versions have four digits.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:40 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

Sorry, Message Broker 7.0.0.2
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 1:41 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

You can control the naming of files using $LocalEnvironment/Destination/File/Name . Append a time to that name and you'll have aunique file every time.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:43 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

lancelotlinc wrote:
You can control the naming of files using $LocalEnvironment/Destination/File/Name . Append a time to that name and you'll have aunique file every time.


Yes, I thought of that too and its a good fix, however, the system consuming the file cannot handle a timestamp in the file name (sad isn't it?).
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 1:44 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

I said "time" not "timestamp". As far as the file system is concerned, its just a string of numbers.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:49 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

lancelotlinc wrote:
I said "time" not "timestamp". As far as the file system is concerned, its just a string of numbers.


In either case, they want a file called, output.xml everytime, that's what I meant by cannot handle timestamp.

I just remembered that I might have some control over that because there is a flow that picks up this created file and FTP's it over to their server. I think I can look at the filename and change it in that flow before it goes out the door. Thanks for the idea!

Is there no way that you know of to do what I was asking though?
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 1:51 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

1. >> In either case, they want a file called, output.xml everytime << So you take the file that was created and you rename it to whatever filename they want.

2. >> Is there no way that you know of to do what I was asking though? << Using JCN or ESQL, delete the file in your exception processing.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:53 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

OK great. Thanks for the help.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 1:55 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Glad to help out. Should be an easy task to delete the partial file in your exception processing. Post back if you run into problems.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 1:59 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

I actually think the first solution of renaming works better for me because I already have another flow reading that file where I can control the rename. If I had to delete, I would use jcn to call a shell script. Out of curiosity is there an easier way?
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Mar 05, 2012 2:04 pm    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

JCN to shell script is good. JCN directly (ie. java.io.File class ) also would work. Remember, anything you can do in a POJO, you can do from a JCN. For Java code more than a line or two, I prefer to use a Jar and write Junits against the Jar. Then call the Jar from the JCN. Also, directly calling log4j from JCN or ESQL is a great way to verify functionality during operation.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
cwazpitt3
PostPosted: Mon Mar 05, 2012 2:12 pm    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

We actually use the IAM3 support package and do logging throughout our code. It has its quirks but it works pretty good. Do you use jcn a lot? I thought the best practices from IBM said to avoid if possible. That's a good tip to create a separate jar and use junit; its typically what we do. Wish mb provided some type of automated unit testing.
Back to top
View user's profile Send private message
cociu_2012
PostPosted: Tue Mar 06, 2012 12:39 am    Post subject: Reply with quote

Acolyte

Joined: 06 Jan 2012
Posts: 72

cwazpitt3 wrote:
If I had to delete, I would use jcn to call a shell script. Out of curiosity is there an easier way?


My personal opinion is that using shell script is not a good idea, and it's outside of broker development.

The answer is easy, consume your file.
On error handling mechanism , have a FileRead Node to consume it.

I would change the entire solution, and propagate to FileOutput node when no error/logical error is raised.
Back to top
View user's profile Send private message
cwazpitt3
PostPosted: Tue Mar 06, 2012 4:14 am    Post subject: Reply with quote

Acolyte

Joined: 31 Aug 2011
Posts: 61

cociu_2012 wrote:
cwazpitt3 wrote:
If I had to delete, I would use jcn to call a shell script. Out of curiosity is there an easier way?


My personal opinion is that using shell script is not a good idea, and it's outside of broker development.

The answer is easy, consume your file.
On error handling mechanism , have a FileRead Node to consume it.

I would change the entire solution, and propagate to FileOutput node when no error/logical error is raised.


@cociu_2012 I like your idea of using the FileRead node in the exception path...I might try that out.

As for your suggestion about changing the entire solution, I really didn't understand what you meant. In this case, I am reading record by record not whole file, so I really cannot stop processing until all records are read (i.e. in ESQL that connects to FinishFile). Even if I throw an exception while processing (i.e. when an error/logical error is found), it must continue to process the rest of the file. Please let me know if this is not what you meant.
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 » How can I halt the creation of a batch file creation
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.