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 » Hunting for records

Post new topic  Reply to topic
 Hunting for records « View previous topic :: View next topic » 
Author Message
nicojvr
PostPosted: Mon Jun 23, 2003 7:31 am    Post subject: Hunting for records Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

Hi guys,

Here's the situation:

I'm bringing in a MRM (Tagged/ delimited format) into a compute node.
the mrm looks like this :

tag data
tag data
tag data

I want to put this into a 2 dimensional array which looks the same, but allows me to search up and down for records.
Does eSql allow this? And if i can access a MRM this way, how do i do it? I am fairly new to MQSI..


thanks
Nico
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Mon Jun 23, 2003 7:56 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Suppose you have a very simple message defined in MRM like
    Message
      DataElement
You set up the DataElement field to have the tag you want, and you set it up to be a repeating element.

Then in your ESQL, you do something like
Code:
InputRoot.MRM.Message.DataElement[1]
to access the first DataElement in your message.
Back to top
View user's profile Send private message
kirani
PostPosted: Mon Jun 23, 2003 9:29 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Nico,
If i understand your question correctly, your message has following layout,
tag1 data1
tag2 data2
tag3 data3
....

Now, you want to store these values in a 2 dimensional array, so that you can refer to them as indexes, for example, myvar[tag2] will give you data2?
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
nicojvr
PostPosted: Mon Jun 23, 2003 11:47 pm    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

exactly..
Back to top
View user's profile Send private message
Craig B
PostPosted: Tue Jun 24, 2003 3:55 am    Post subject: Reply with quote

Partisan

Joined: 18 Jun 2003
Posts: 316
Location: UK

As indicated in the previous updates the message tree gives array indexing for same named elements such that different elements in the array can be accessed via an index number such as [1] etc. WMQI does not give this support with scalar variables such that you cant DECLARE an array of 10 Character variables like you can in C for example.

So you can use the indexing in message tree fields references to give you what you require. The purpose of this response is to just mention that if you have lots of repeating fields then this is not the preferred method of accessing the data. Functionally it is fine but may give you performance issues if you start using 100s of these fields or in extreme cases, 100s of thousands.

The reason it has a performance implication is the nature of accessing the data in the message tree. Take the following example :

Code:

SET myFirstName = InputRoot.XML.TestCase.repField[1];
SET mySurName = InputRoot.XML.TestCase.repField[2];
SET myMiddleName = InputRoot.XML.TestCase.repField[3];
SET myAccount = InputRoot.XML.TestCase.repField[4];


In this example four instances of a field called repField are accessed. These will be evaluated independently on each of the SET statements and there is no marker in the message tree to indicate that a previous instance was searched over. So for the first SET statement, the value of InputRoot.XML.TestCase.repField[1] needs to be resolved. This will involve a search of the input message tree firstly for a folder called 'XML'. Once this has been found then a child called TestCase will be searched for at the first child depth in the message tree. Then the first instance of repField will need to be found at the next depth. As you can see, the more fields that there are in the message tree, the longer this search will take. Then when repField[2] is searched for then the same process is initiated again from the start since this is a completely separate field reference in a completely different ESQL statement. This starts at the beginning of the message tree, and this search is a little longer than the first because this has to keep searching for the second occurence which does not have to directly next to the first in the tree ... it just has to be a SIBLING. Although we are talking milliseconds for this type of operation ... when dealing with a large number of repetitions then this can add seconds to the compute node processing. The most extreme example of this I have seen is the creation of 1 million repeating fields. This took around 1 hour 15 minutes to complete. When it was rewritten to us REFERENCE variables it took around 13 seconds.

Therefore at this early stage of development I would consider how many repeating fields you are likely to see in your message. If this is alot then I would consider accessing the array contents using REFERENCE variables which maintains a pointer in the message tree and therefore cuts out this linear search each time. For example :

Code:

DECLARE myInRef REFERENCE TO InputRoot.XML.TestCase.repField[1];
WHILE LASTMOVE(myInRef) DO
  -- Perform necessary ESQL on myInRef for this instance.. then
  MOVE myInRef NEXTSIBLING NAME 'repField'; -- Accesses next array item
END WHILE;


The same is true for creating new repeating fields using the SET command such as SET OutputRoot.XML.TestCase.repfield[100] = .....

You can maintain a REFERENCE in the output that means you can use the CREATE statement to create SIBLINGs and children. The SET statement would also have to search the tree to find where to insert the new field.

I hope this does not confuse you to much and highlights of accessing large arrays in message tree before you implement a solution that you later find does not perform as expected.
_________________
Regards
Craig
Back to top
View user's profile Send private message
nicojvr
PostPosted: Tue Jun 24, 2003 5:46 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

Thanks alot craig, I will have huge amounts of repeating fields in my input message.

2 questions though:

1. I wont have elements in the MRM as the message will be coming in via Tagged / delimited format i.e. the accessor InputRoot.XML.elementname
will not function correctly.

2. also how do i get to the tag (see previous post) part of the field.

thanks

Nico
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 24, 2003 5:50 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

If you actually need to use the tag itself in your ESQL, you can't use it as a tag in the MRM. It's "eaten" by the parser, and reemited when the tree is collapsed back to a bitstream.

But you might be able to do what you want with either dynamic field references or using the new {} syntax in CSD04. Or by using Select on the message tree.

Maybe you could describe a little better what you're looking to accomplish? That is, why do you want to be able to use the equivalent of a Perl hash reference?
Back to top
View user's profile Send private message
drajib
PostPosted: Tue Jun 24, 2003 6:08 am    Post subject: Reply with quote

Apprentice

Joined: 25 Mar 2003
Posts: 42
Location: India

Nico,
If you would like to have the tags as elements in the message tree then you need to look at other options like use of Data Patterns (credit goes to Craig on http://www.mqseries.net/phpBB2/viewtopic.php?t=9329).


Craig,
On the same note ..... I was trying to clear my understanding with Data Patterns. W.r.t. the above stated topic, I'm able to parse messages with no s2 and single s2, but failing to achieve multiple s2. Would you be able to let me know what am I doing wrong, if I send you the exported message structure and flow!!!

Best regards,
Back to top
View user's profile Send private message
nicojvr
PostPosted: Tue Jun 24, 2003 6:43 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

First some background.
I am in the HealthCare industry, and as a standard we have received files over the years that contain claims. These files are coming in in edifact format ( i know what you're thinking and no the EDIFACT thinger in MQSI doesn't work ) These files will now be coming into our system via mqseries and need to be put into our database (Oracle 9i) after some arbitrary validation (i.e. patient number, doctor practice number etc). The files contain certain tags to identify the information i.e.
This line :
UNB+UNOA:1+SANLAMHEALTH+BONITAS+030603:1529+1004++MEDCLM
would mean
unb = message header follows
UNOA:1 = controlling agency:version
SANLAMHEALTH = receiver
BONITAS = sender
030603:1529 = date and time file was prepared
1004 = unique reference number
MEDCLM = claim type i.e MEDical CLaiM


now for the problem
I need to get the above into an XML format i.e.
<ediFile>
<controllingAgency>UNOA</controllingAgency>
<version>1</version>
....
....
</ediFile>

Each tag identifies a different set of data hence the neccecity to have access to the tags.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 24, 2003 7:06 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Okay, so you're looking at the 'unb' as the tag? Otherwise it just looks like delimited data, but not tagged.

If you need to make decisions inside ESQL based on whether or not the incoming message contained a 'unb' structure, you can do that based on the logical elements you've created, without needing to explicitly look for the string 'unb'. That is, if you've set up your model to call the 'unb' group 'MessageHeader' (i.e. created an element called MessageHeader of a compound type that describes the Edifact message header in question), then you can check for the existance of a 'MessageHeader' element in your message tree in ESQL.

If you want to convert MRM data to XML, the easiest way is to add an XML format layer. Then you can specify the XML tag names for each logical element. So for instance you could create a logical element called "ControllingAgency", and give it an XML tag name of "controllingAgency". Then you'd set up the TDS layer properties to properly identify that UNOA was the ControllingAgency element.

Then you read the message in as TDS/MRM, and set the output format to write the message tree back out as XML.
Back to top
View user's profile Send private message
nicojvr
PostPosted: Tue Jun 24, 2003 7:54 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

Hi Jeff, I have created the XML Layer (created a DTD of what the Xml should look like and imported that). Now how do I tell MQSI that the UNOA belongs to the controllingAgency Tag ?

I am fairly new at this as you may have guessed

thanks

Nico
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jun 24, 2003 9:37 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You'll have to add a Tagged Delimited Format layer as well, and set the properties of it to identify that the controllingAgency (and the rest of your tags) is the section of the bitstream that contains "UNOA".

If you go through the Working with Messages, it should help.
Back to top
View user's profile Send private message
nicojvr
PostPosted: Wed Jun 25, 2003 4:54 am    Post subject: Reply with quote

Apprentice

Joined: 04 Jun 2003
Posts: 45

Thanks alot for the posts,
I have created the tagged delimited format and the XML layer .i have imported the dtd. Can you please give me a example of what the TDS format Message should look like ? i currently parse it without any elements and it creates the data in the correct format? Will it work to now add elements on to the current message ? Also i am having alot of trouble checking in the imported DTD ? i get BIP0005E ?

thanks a mil.


Cheers

Nico
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 » Hunting for records
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.