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 IndexWebSphere Message Broker Supporteach message from one single file

Post new topicReply to topic
each message from one single file View previous topic :: View next topic
Author Message
dinu7102
PostPosted: Sun May 14, 2017 10:53 pm Post subject: each message from one single file Reply with quote

Newbie

Joined: 14 May 2017
Posts: 8

Hi Friends,

I need your help one below requirement.
I need total count from one single file that how many messages are there in it.For each message the message start with "{" and end with "-}".I need the logic in Esql.

EX : total message count : 3(for below sample)

file format :
{
A1
B1
C1
-}
{
A2
B2
C3
-}
{
A3
B3
C3
-}


thank you
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 4:20 am Post subject: Re: each message from one single file Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24328
Location: Ohio, USA

dinu7102 wrote:
For each message the message start with "{" and end with "-}".I need the logic in Esql.


Model the message in DFDL. Read the message count provided by the FileInput node using ESQL.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
dinu7102
PostPosted: Mon May 15, 2017 6:22 am Post subject: Reply with quote

Newbie

Joined: 14 May 2017
Posts: 8

Hi Vitor,

Thank you.

I need to write the code only in compute node because we are not using filenode.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 6:32 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24328
Location: Ohio, USA

dinu7102 wrote:
I need to write the code only in compute node because we are not using filenode.


My bad - I was confused by this comment:

dinu7102 wrote:
I need total count from one single file


which I misunderstood to mean you were using a file.

If you're not, then you'll need to model the message in DFDL and obtain the cardinality in ESQL.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
dinu7102
PostPosted: Mon May 15, 2017 9:15 am Post subject: Reply with quote

Newbie

Joined: 14 May 2017
Posts: 8

Thanks Vitor.

already its existing interface.I will try with cardinality.
In casse u know any other logic pls let me know.
Back to top
View user's profile Send private message
Vitor
PostPosted: Mon May 15, 2017 9:33 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24328
Location: Ohio, USA

dinu7102 wrote:
already its existing interface.


So you don't need to model it then, do you?

dinu7102 wrote:
I will try with cardinality.


"Try"? You think the ESQL function has a bug in it and it might not work?

dinu7102 wrote:
In casse u know any other logic pls let me know.


Other than doing it the best way you mean?

Given that you've a) just now said it's an existing interface and b) given no details about how this interface presents the data then it's really hard for me to do your job for you as you ask.

You could probably build some kind of hash map to determine instances. Probably. Depending on how the data's being presented you might have to think carefully about where you're storing it. You of course couldn't use any of the inbuilt facilities for hash maps that Java possesses because you're determined in the face of all sense and reason to do this in ESQL rather than any other way which (glup!) might change an existing interface.

Which you are of course changing by adding logic to count records in a node which is specifically designed to change record content and will require this existing interface to be as fully tested as if you're done this properly.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
dinu7102
PostPosted: Mon May 15, 2017 9:51 am Post subject: Reply with quote

Newbie

Joined: 14 May 2017
Posts: 8

Thanks Vitor.
Back to top
View user's profile Send private message
dinu7102
PostPosted: Thu May 18, 2017 7:27 am Post subject: Reply with quote

Newbie

Joined: 14 May 2017
Posts: 8

Hi Vitor,

I had used length and replacing.

DECLARE LENGTH1,LENGTH2 INTEGER;


SET LENGTH1= LENGTH(REPLACE(Orginalmessage, '{ ', ','));
SET LENGTH2 = LENGTH(Orginalmessage)-LENGTH1;
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu May 18, 2017 7:38 am Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 24328
Location: Ohio, USA

dinu7102 wrote:
I had used length and replacing.

DECLARE LENGTH1,LENGTH2 INTEGER;


SET LENGTH1= LENGTH(REPLACE(Orginalmessage, '{ ', ','));
SET LENGTH2 = LENGTH(Orginalmessage)-LENGTH1;


Awesome. A massively inefficient way of doing with hand written code to do what IIB will do for you.

(String handling is the most resource expensive part of IIB).

But it's your site, your requirement and go in peace with your solution.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Display posts from previous:
Post new topicReply to topic Page 1 of 1

MQSeries.net Forum IndexWebSphere Message Broker Supporteach message from one single file
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.