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 to Store trace data in a variable using esql

Post new topic  Reply to topic Goto page 1, 2  Next
 How to Store trace data in a variable using esql « View previous topic :: View next topic » 
Author Message
HarishKDewangan
PostPosted: Tue Feb 14, 2012 2:44 am    Post subject: How to Store trace data in a variable using esql Reply with quote

Novice

Joined: 23 Sep 2011
Posts: 13

I have a requirement of storing the trace data in a variable as String

Trace data :

(0x01000013):body = (
(0x0300000B):numberOfRecordsReturned = 0
(0x0300000B):totalRecordsFound = 0
).....
)


Trace node equivalent code : ${Root.MRM}

I have to store 'Data in bold' which is a logical tree into a string using esql something like this :

Declare INPUTSTR CHARACTER;
SET INPUTSTR = CAST(InputBody As Character);

If anyone has idea of how to do this, please let me know.

Thanks in advance!!!
Harish
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 14, 2012 2:58 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you need to convert a message tree into a flattened bitstream, you need to use ASBITSTREAM function in ESQL.
Back to top
View user's profile Send private message
HarishKDewangan
PostPosted: Tue Feb 14, 2012 3:53 am    Post subject: Reply with quote

Novice

Joined: 23 Sep 2011
Posts: 13

I did try the ASBITSTREAM like this :

DECLARE Inputmsg CHARACTER;
DECLARE bSourceText CHARACTER ASBITSTREAM(InputBody);
SET Inputmsg = CAST(bSourceText AS CHARACTER CCSID InputRoot.MQMD.CodedCharSetId);

But it says "Invalid wire format".

Actually I am passing a flat string to CWF wire format (Domain : MRM) & trying to store the logical tree as it is in string variable.

MQInput ---> ComputeNode----> MQOutput
Back to top
View user's profile Send private message
adubya
PostPosted: Tue Feb 14, 2012 3:57 am    Post subject: Reply with quote

Partisan

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

Code:
DECLARE bSourceText CHARACTER


Shouldn't this be a BLOB ?
Back to top
View user's profile Send private message Send e-mail
HarishKDewangan
PostPosted: Tue Feb 14, 2012 4:22 am    Post subject: Reply with quote

Novice

Joined: 23 Sep 2011
Posts: 13

After changing bSourceText to BLOB, Inputmsg variable has the same value what I passed as input (flatstring), but my requirement is to have the complete logical tree as string which I mentioned below.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Feb 14, 2012 4:44 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Just to put up an alternative to the ASBITSTREAM function: Use FIELDNAME to get the name of the element and construct the string (CHAR) manually

Probably use FIELVALUE, though I am currently not sure why you should.

There is a post in this forum, where someone wrote this in Java (which probably is the counterpart to this).

As a task write the code in ESQL and let us know.
_________________
Just use REFERENCEs


Last edited by mqsiuser on Tue Feb 14, 2012 4:55 am; edited 2 times in total
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Feb 14, 2012 4:45 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You can also use string concatenation to build your flattened string, if you don't choose to pass enough information in to asbitstream to give it what it needs.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Feb 14, 2012 7:58 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.

There are plenty of posts in this foum asking the very same question.

Viz

How do I put a complete Tree into a single string vairable.

Mr Google is your firend here.
_________________
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
mqsiuser
PostPosted: Tue Feb 14, 2012 8:19 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

smdavies99 wrote:
There are plenty of posts in this foum asking the very same question.

Viz

How do I put a complete Tree into a single string vairable.

Mr Google is your firend here.


Pointing to google !? Sorry, that doesn't help too much. What is your favorite approach. ASBITSTREAM, coding yourself or what else ?! If you point to google then also supply a link ... please.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 14, 2012 8:23 am    Post subject: Reply with quote

Grand High Poobah

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

mqsiuser wrote:
If you point to google then also supply a link ... please.


www.google.com


Seriously, pointing someone to Google is shorthand for "there are loads of potential methods, do some research, pick one that meets your requirements and post back here if you have a specific problem".

mqsiuser wrote:
What is your favorite approach. ASBITSTREAM, coding yourself or what else ?!


You don't have favourite methods. You have the one that works best for your particular requirement. Sometimes there's a "best practice" one that works for most requirments.

Sometimes there's one that never works best (like itterating through a message tree with CARDINALITY).
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Feb 14, 2012 8:47 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

Vitor wrote:
Seriously, pointing someone to Google is shorthand for "there are loads of potential methods, do some research, pick one that meets your requirements and post back here if you have a specific problem".

fair enough

Vitor wrote:
Sometimes there's a "best practice" one that works for most requirments.

Sometimes there's one that never works best (like itterating through a message tree with CARDINALITY).


There are misperceptions. Some hints, ups and downs are also nice to hear some times. Some current discussions, since time progresses! Google is an historical archive.
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Feb 14, 2012 9:20 am    Post subject: Reply with quote

Grand High Poobah

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

mqsiuser wrote:
Google is an historical archive.


Don't let their lawyers hear you say that. Each Google search is a fresh Dance across the Internet.

The results of such a search will turn up all the solutions people have written and discussed on the web, which is what most people want. If you want a more targetted search, use the little box top right of this page which is Powered By Google. No threads are deleted in here either.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
HarishKDewangan
PostPosted: Wed Feb 15, 2012 3:18 am    Post subject: Reply with quote

Novice

Joined: 23 Sep 2011
Posts: 13

Thanks all for your quick replies.

This is how I did it :

Code:
CREATE FUNCTION Main() RETURNS BOOLEAN
   BEGIN
      CALL CopyMessageHeaders();
      set OutputRoot.Properties.MessageFormat = 'XML1';
      DECLARE flatstructure character;
      SET flatstructure = '';
      call ComposeDetails(InputBody,flatstructure);
      --flatstructure has all the fieldName:fieldValue pair...
      END;
   
    CREATE PROCEDURE ComposeDetails(IN root REFERENCE,INOUT flatstructure CHARACTER) BEGIN
      Declare fieldName CHARACTER;
      Declare fieldValue CHARACTER;
      SET  fieldName = FIELDNAME(root);
      SET  fieldValue = FIELDVALUE(root);
      IF (fieldValue is not null) THEN
          SET flatstructure =  flatstructure||fieldName ||':' ||fieldValue;
       ELSE
         SET flatstructure =  flatstructure||fieldName ;
      end if;
      DECLARE cursor REFERENCE TO root;
      MOVE cursor FIRSTCHILD;
      WHILE LASTMOVE(cursor)
          DO CALL ComposeDetails(cursor,flatstructure);
         MOVE cursor NEXTSIBLING;
      END WHILE;
    END;


Thanks once again to mqjeff & mqsiuser for your suggestion.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Feb 15, 2012 5:18 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Warning: looking as you are a newbie on the forum, supplied the code tags for you. Next time don't forget to use them!
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
HarishKDewangan
PostPosted: Wed Feb 15, 2012 5:24 am    Post subject: Reply with quote

Novice

Joined: 23 Sep 2011
Posts: 13

Sure thing fjb_saper
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 to Store trace data in a variable using esql
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.