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 » WMB File Handling with MQ Batch

Post new topic  Reply to topic
 WMB File Handling with MQ Batch « View previous topic :: View next topic » 
Author Message
rampriya
PostPosted: Tue Aug 13, 2013 10:13 am    Post subject: WMB File Handling with MQ Batch Reply with quote

Newbie

Joined: 27 Jul 2009
Posts: 9

Hi,
I am currently trying to write batch of records into file using file output.
My Scenario would be
There are 1000 msgs (request) in the queue each request would invoke backend service (SOAP Request). Send the response to next output queue for further processing and also write the response to a file (would like to create single file, but with my code it is creating multiple files)
For each request I will get 1 to many response, like that I need to consolidate the response of all the 1000 msgs into 1 file, but with my current code it is creating multiple files.
Following is the code which I am using to send the request to the queue

Code:


SET modelCount = CARDINALITY(inRef.tns:FindOrderResponse.orders[]);
SET z = 0;
 
WHILE z < modelCount DO -- send the Order info to invoice q
SET z = z +1;
CALL CopyMessageHeaders();
SET OutputRoot.MQMD.GroupId = X'000000000000000000000000000000000000000000000003';
SET OutputRoot.MQMD.MsgSeqNumber = z;
SET OutputRoot.MQMD.MsgFlags = MQMF_MSG_IN_GROUP;
IF (z = modelCount) THEN
SET OutputRoot.MQMD.MsgFlags = MQMF_LAST_MSG_IN_GROUP;
END IF;
 
SET OutputRoot.XMLNSC.findOrders.CustomerID = ev.load.CustomerID;
SET OutputRoot.XMLNSC.findOrders.OrderID = inRef.tns:FindOrderResponse.orders[z].OrderID;
PROPAGATE TO TERMINAL 'out1';



Following is the code to write to the file:
Code:

IF ev.MQMD.MsgFlags = MQMF_MSG_IN_GROUP THEN
SET outRef1.CustomerID VALUE = ev.load.CustomerID;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
IF ev.MQMD.MsgSeqNumber = 1 THEN
SET OutputLocalEnvironment.WrittenDestination.Action = 'Create';
ELSE
SET OutputLocalEnvironment.WrittenDestination.File.Action = 'Append';
END IF;
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
ELSE
SET outRef1.CustomerID VALUE = ev.load.CustomerID;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Append';
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Finish';
PROPAGATE TO TERMINAL 'out3' DELETE NONE;
END IF;



But this code writing multiple file instead of creating single file, Can any one help me to find the solution for my problem.

Thanks,
Ramanujan


Last edited by rampriya on Tue Aug 13, 2013 10:55 am; edited 2 times in total
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Aug 13, 2013 10:20 am    Post subject: Reply with quote

Jedi Council

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

some points to look at.

1) What is the version of the MQMD structure that supports message grouping
2) Use C O D E tags in your post as it makes it easier for us humans to read.
3) Have you analysed what is going on and why you are getting multiple messages with simple things like
- Strategically placed trace nodes
- User trace output

4) What do the messages when places on a queue look like? Is everything Ok including all the data in the MQMD?
_________________
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
mqjeff
PostPosted: Tue Aug 13, 2013 10:37 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

What place in the message tree does the FileOutput node use to determine what it should do?
Back to top
View user's profile Send private message
kash3338
PostPosted: Tue Aug 13, 2013 9:09 pm    Post subject: Re: WMB File Handling with MQ Batch Reply with quote

Shaman

Joined: 08 Feb 2009
Posts: 709
Location: Chennai, India

rampriya wrote:
But this code writing multiple file instead of creating single file, Can any one help me to find the solution for my problem.


Code:
IF ev.MQMD.MsgSeqNumber = 1 THEN
SET OutputLocalEnvironment.WrittenDestination.Action = 'Create';
ELSE
SET OutputLocalEnvironment.WrittenDestination.File.Action = 'Append';
.
.
SET OutputLocalEnvironment.WrittenDestination.Action = 'Append';
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Finish';


At one place you have used,
Code:
OutputLocalEnvironment.WrittenDestination.Action


And at other place its,
Code:
OutputLocalEnvironment.WrittenDestination.File.Action


What is the setting in Records And Elements - Record Definition property in your FileOutput node?
Back to top
View user's profile Send private message Send e-mail
Simbu
PostPosted: Tue Aug 13, 2013 9:51 pm    Post subject: Re: WMB File Handling with MQ Batch Reply with quote

Master

Joined: 17 Jun 2011
Posts: 289
Location: Tamil Nadu, India

rampriya wrote:


Following is the code to write to the file:
Code:

IF ev.MQMD.MsgFlags = MQMF_MSG_IN_GROUP THEN
SET outRef1.CustomerID VALUE = ev.load.CustomerID;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
IF ev.MQMD.MsgSeqNumber = 1 THEN
SET OutputLocalEnvironment.WrittenDestination.Action = 'Create';
ELSE
SET OutputLocalEnvironment.WrittenDestination.File.Action = 'Append';
END IF;
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
ELSE
SET outRef1.CustomerID VALUE = ev.load.CustomerID;
SET outRef1.xmlBlob = InputRoot.XMLNSC.toJava.xmlBlob;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Append';
PROPAGATE TO TERMINAL 'out2' DELETE NONE;
SET OutputLocalEnvironment.WrittenDestination.Action = 'Finish';
PROPAGATE TO TERMINAL 'out3' DELETE NONE;
END IF;





Usage of LocalEnvironment is wrong here. Did you read InfoCenter on how to use LocalEnvironment with file nodes before you write the code. If not please read it.
Back to top
View user's profile Send private message
Tibor
PostPosted: Thu Aug 15, 2013 1:23 am    Post subject: Reply with quote

Grand Master

Joined: 20 May 2001
Posts: 1033
Location: Hungary

Please check your FileOutput node, as Infocenter mentions: "If you set the Record definition property to Record is Whole File on the Records and Elements tab, messages received on the Finish File processing are ignored because the file has already been processed."
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WMB File Handling with MQ Batch
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.