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 » WBIMB msgset - (fixed header) + n-times (fixed body)

Post new topic  Reply to topic
 WBIMB msgset - (fixed header) + n-times (fixed body) « View previous topic :: View next topic » 
Author Message
Testo
PostPosted: Tue Jan 25, 2005 2:26 am    Post subject: WBIMB msgset - (fixed header) + n-times (fixed body) Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

I have searched the forum for a similar post but I'm not able to find anything useful for my situation.

How can I model a message like this in WBIMB 5 CSD 4:

Header: fixed length (108 bytes)
Body: fixed length (256 bytes) but an undefined number of times

No delimiters, between either the header and the first occurence of the body and the bodies themselves.

Any idea/suggestions/tricks?

Thanks,
Andrea Tedone
IBM IT Specialist
Back to top
View user's profile Send private message Send e-mail MSN Messenger
mqsidude
PostPosted: Tue Jan 25, 2005 4:33 am    Post subject: Reply with quote

Centurion

Joined: 22 Jan 2004
Posts: 148

It can be modelled as a CWF message where the input can be a fixed length string without delimiters as in your case.

The header can be a separate compound type and the body can be another compound type. The compound type representing the body can be attributed with repeating nature. At the same time the number of times this type is going to repeat should be either hardcoded as part of the coumpound type properties or should be carried as a value of an element(which should physically occur before the repeating struvture in the message set).

-Crony
Back to top
View user's profile Send private message
Testo
PostPosted: Tue Jan 25, 2005 4:45 am    Post subject: Thanks Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

I've been working with CWF message sets in the past, with WMQI 2.1, but I've never encoutered a situation - like this one - where the number of occurencies of a part of the message is not defined, either in the message set as a static value nor in the header of the message.

The issue I'm not particularly able to manage is the 'dynamic' structure of the message.

Obviously, I could parse the message as a 'variable length string', determine the length and finally derive the number of occurencies to be saved in an Environment variable... but this does not seem to be very elegant nor efficient.

Any other suggestion or idea?

Thanks in advance,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Tue Jan 25, 2005 4:52 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Are you sure there's nothing in the body that can be used as a tag, or an anchor for a data pattern?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Testo
PostPosted: Tue Jan 25, 2005 4:56 am    Post subject: It depends... Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Hi Jeff.

The answer is: it depends. I mean, the input message from the iSeries application is still under construction.

If this can help the modeling of the message set in WBIMB, I can ask for a delimiter between the bodies.

And what would happen to the message physical format? Shall it become a TDS one?

Thanks
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
jefflowrey
PostPosted: Tue Jan 25, 2005 5:05 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

For messages that have a variable number of repeating structures, you have two choices on how to model them in WBIMB.

One is with CWF. If you use CWF, then you *have* to have an integer value in the message that occurs before the variable number of repeats (in this case, in your header) that tells how many repeats are in this particular message.

The other way is with TDS. With TDS, you do not need a field that holds a repeat count. But you do need some way, either a tag or a delimiter, to indicate the start or end of one repeat structure.

So you can either have them add a repeat count to the header, and use CWF, or you can have them add a tag or delimiter to the body and use TDS.

Adding a tag at the front will be slightly easier to model and slightly easier for them to program. In my opinion.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Testo
PostPosted: Tue Jan 25, 2005 5:39 am    Post subject: Hero-Jeff! Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Jeff,

thanks for the clear and valuable help, now I understand really better the available options.

Have a great day,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kimbert
PostPosted: Tue Jan 25, 2005 6:57 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Hold on! There is a way to do this...

1. Create a message which describes the 108-byte header
2. Create a message which describes the 256-byte repeating record
3. Remove the 108-byte header from the message ( probably best done in the BLOB domain)
4. Using CREATE FIELD PARSE, parse the header against the header's message definition
5. Enter a loop which repeatedly takes 256-byte chunks of the bitstream and uses CREATE FIELD PARSE statements to parse them using the structure's message definition.

It's not pretty, but I think it will work!
Back to top
View user's profile Send private message
shanson
PostPosted: Tue Jan 25, 2005 7:16 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

To parse a TDS message with unbounded repeats, you really need to use tags. Delimiters (AED) on their own won't be sufficient.

Given your starting point, I recommend using CWF and a repeat reference.

These are known requirements which are planned to be addressed:
- CWF unbounded repeats as long as the repeating element is last in the msg (eom)
- TDS unbounded repeats for non-tagged elements, as long as there is an identifiable point to terminate the repeats (eg, GT, delimiter, eom)
Back to top
View user's profile Send private message
Testo
PostPosted: Wed Jan 26, 2005 1:23 am    Post subject: Sample Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Kimbert,

have you got any sample of ESQL code where you use the CREATE FIELD PARSE function? I've browsed the documentation but with no success...

Thanks,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
kimbert
PostPosted: Wed Jan 26, 2005 1:37 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

try this: http://www.mqseries.net/phpBB2/viewtopic.php?t=17027
Back to top
View user's profile Send private message
shanson
PostPosted: Wed Jan 26, 2005 1:41 am    Post subject: Reply with quote

Partisan

Joined: 17 Oct 2003
Posts: 344
Location: IBM Hursley

This is taken from the V5 help topic Reference->ESQL->ESQL statements->Create statement at CSD5 level.

The following example shows how to use the PARSE clause:


DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML, InputProperties.Encoding, InputProperties.CodedCharSetId);
DECLARE creationPtr REFERENCE TO OutputRoot;
CREATE LASTCHILD OF creationPtr DOMAIN('XML') PARSE(bodyBlob, InputProperties.Encoding, InputProperties.CodedCharSetId);

This example can be extended to show the serializing and parsing of a field or folder:
DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML.TestCase.myFolder, InputProperties.Encoding, InputProperties.CodedCharSetId,",",",FolderBitStream);
DECLARE creationPtr REFERENCE TO OutputRoot;
CREATE LASTCHILD OF creationPtr DOMAIN('XML') PARSE(bodyBlob, InputProperties.Encoding, InputProperties.CodedCharSetId,",",",FolderBitStream);

The following example shows how you can use the DOMAIN clause to avoid losing information unique to the XML parser when an unlike parser copy occurs:
DECLARE bodyBlob BLOB ASBITSTREAM(InputRoot.XML, InputProperties.Encoding, InputProperties.CodedCharSetId);
CREATE FIELD Environment.Variables.myXMLTree;
DECLARE creationPtr REFERENCE TO Environment.Variables.myXMLTree;
CREATE FIRSTCHILD OF creationPtr DOMAIN('XML') PARSE(bodyBlob, InputProperties.Encoding, InputProperties.CodedCharSetId);
Back to top
View user's profile Send private message
Testo
PostPosted: Wed Jan 26, 2005 1:57 am    Post subject: Thanks Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Thank you kimbert and Steve for your support.

I'll work on this the whole day.

Cheers,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Testo
PostPosted: Wed Jan 26, 2005 2:42 am    Post subject: Performance Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Just to add something to the discussion.... PERFORMANCE.

If I consider the input message as a generic string, and use SUBSTRING to retrieve my header and my n-bodies, does this decrease or improve the performance? I know this is not elegant but the issue, for this piece of integration, is to get the faster solution.

Are there any comparisons between MRM parsing with the CREATE FIELD PARSE option, as discussed above or instead the multiple use of the SUBSTRING function?

Cheers,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Testo
PostPosted: Wed Jan 26, 2005 7:41 am    Post subject: SUBSTRING Reply with quote

Centurion

Joined: 26 Feb 2003
Posts: 120
Location: Italy - Milan

Parsing the whole message as a string and browsing it with the SUBSTRING fuction I have the following results:

- [header 155 bytes] + 270 * [body 236 bytes] = 63875 bytes
- target message is MRM-XML = 141204 bytes
- elapsed time: 7.4 seconds

This is the ESQL code:

Code:

      SET OutputRoot.Properties.MessageSet = 'KTEP7OO002001';
      SET OutputRoot.Properties.MessageType = 'ComplianceDataset';
      SET OutputRoot.Properties.MessageDomain = 'MRM';
      SET OutputRoot.Properties.MessageFormat = 'XML1';
      
      
      DECLARE msg, header, body, msgResiduo, codProdotto CHAR;
      DECLARE cont,i INTEGER;
      
      SET msg = InputRoot.MRM.stringa;
      SET header = SUBSTRING(msg FROM 1 FOR 155);
      SET msgResiduo = SUBSTRING(msg FROM 156);
      
      SET codProdotto = SUBSTRING(header FROM 21 FOR 15);
      
      -- header >> Product
      
      SET OutputRoot.MRM.Product.idProduct = codProdotto;
      SET OutputRoot.MRM.Product.ProductDescription = SUBSTRING(header FROM 36 FOR 40);
      SET OutputRoot.MRM.Product.InfoDate = SUBSTRING(header FROM 76 FOR 4) || '-' || SUBSTRING(header FROM 80 FOR 2) || '-' || SUBSTRING(header FROM 82 FOR 2);
      SET OutputRoot.MRM.Product.NAVDate = SUBSTRING(header FROM 84 FOR 4) || '-' || SUBSTRING(header FROM 88 FOR 2) || '-' || SUBSTRING(header FROM 90 FOR 2);
      SET OutputRoot.MRM.Product.FlowState = SUBSTRING(header FROM 92 FOR 1);
      SET OutputRoot.MRM.Product.idOwner = SUBSTRING(header FROM 93 FOR 2);
      SET OutputRoot.MRM.Product.NAV = SUBSTRING(header FROM 95 FOR 18) || '.' || SUBSTRING(header FROM 113 FOR 2);
      SET OutputRoot.MRM.Product.PortfolioCTV = SUBSTRING(header FROM 115 FOR 18) || '.' || SUBSTRING(header FROM 133 FOR 2);
      SET OutputRoot.MRM.Product.Attivita = SUBSTRING(header FROM 135 FOR 18) || '.' || SUBSTRING(header FROM 153 FOR 2);
      
      -- /header >> Product
      
      SET cont = LENGTH(msgResiduo) / 236;
      SET i = 1;
      
      WHILE (i <= cont) DO
      
         
         SET body = SUBSTRING(msgResiduo FROM 1 FOR 236);
         
         -- body >> Position
                  
         SET OutputRoot.MRM.Position[i].idProduct = codProdotto;
         SET OutputRoot.MRM.Position[i].PositionType = SUBSTRING(body FROM 36 FOR 1);
         SET OutputRoot.MRM.Position[i].idConstType = SUBSTRING(body FROM 37 FOR 1);
         SET OutputRoot.MRM.Position[i].idConst = SUBSTRING(body FROM 38 FOR 20);
         SET OutputRoot.MRM.Position[i].Description = SUBSTRING(body FROM 58 FOR 40);
         SET OutputRoot.MRM.Position[i].AV = SUBSTRING(body FROM 98 FOR 1);
         SET OutputRoot.MRM.Position[i].Nominale = SUBSTRING(body FROM 99 FOR 15) || '.' || SUBSTRING(body FROM 114 FOR 5);
         SET OutputRoot.MRM.Position[i].PLoc = SUBSTRING(body FROM 119 FOR 13) || '.' || SUBSTRING(body FROM 132 FOR 7);
         SET OutputRoot.MRM.Position[i].PEur = SUBSTRING(body FROM 139 FOR 18) || '.' || SUBSTRING(body FROM 157 FOR 2);
         SET OutputRoot.MRM.Position[i].Cambio = SUBSTRING(body FROM 159 FOR 13) || '.' || SUBSTRING(body FROM 172 FOR 7);
         SET OutputRoot.MRM.Position[i].Controvalore = SUBSTRING(body FROM 179 FOR 18) || '.' || SUBSTRING(body FROM 197 FOR 2);
         SET OutputRoot.MRM.Position[i].ValueDate = SUBSTRING(body FROM 199 FOR 4) || '-' || SUBSTRING(body FROM 203 FOR 2) || '-' || SUBSTRING(body FROM 205 FOR 2);
         --SET OutputRoot.MRM.Position[i].TermValueDate = SUBSTRING(body FROM 207 FOR 4) || '-' || SUBSTRING(body FROM 211 FOR 2) || '-' || SUBSTRING(body FROM 213 FOR 2);
         SET OutputRoot.MRM.Position[i].TermValueDate = '1900-01-01';
         SET OutputRoot.MRM.Position[i].FXCurrency = SUBSTRING(body FROM 215 FOR 15);
         SET OutputRoot.MRM.Position[i].Type = SUBSTRING(body FROM 230 FOR 6);
         SET OutputRoot.MRM.Position[i].isCustom = CAST( SUBSTRING(body FROM 236 FOR 1) AS INTEGER);         
         
         -- /body >> Position
         
         SET msgResiduo = SUBSTRING(msgResiduo FROM 237);
         SET i = i + 1;
      END WHILE;
            


I'm not able to determine the quality of this result without any comparison...

I'll try now the other path.

Cheers,
Andrea
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » WBIMB msgset - (fixed header) + n-times (fixed body)
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.