Author |
Message
|
Broker |
Posted: Tue Apr 17, 2012 8:52 am Post subject: Message set using delimiters count. |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
Hello,
I am trying to build a message set Such that
Header has 3 fields in it and First field either starts with a Y or N
body has 17 fields in it and can have multiple occurances.
Trailer Has 3 fields and can have multiple occurances.
Each field is Separated with |.
There is no particular format for the body or the trailer, they can take any value. So, I thought as the number of fields are fixed, I can differentiate body and trailer by counting the number of delimiters in them but I am unaware of how to build such a message set. Can any one help me please? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 17, 2012 10:16 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
If you can't differentiate between the last repeat of the body and the first repeat of the trailer, you're in trouble in general. |
|
Back to top |
|
 |
Broker |
Posted: Tue Apr 17, 2012 11:10 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
If I can take all the ones with 16"|" as a body and 2 "|" as a trailer, Will I not be able to Differentiate them? |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 17, 2012 12:12 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
MRM won't know that it doesn't have 16 until it's failed to find 4. |
|
Back to top |
|
 |
mapa |
Posted: Tue Apr 17, 2012 1:24 pm Post subject: |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
Ask if it is possible for the sending application to add a tag in the first field and the message will be easy to model.
HEAD|f1|f2|f3|
BODY|f1|..|f17|
..
BODY|f1|..|f17|
TAIL|f1|f2|f3|
..
TAIL|f1|f2|f3|
As it is now it is not possible as far as I know. |
|
Back to top |
|
 |
mqsiuser |
Posted: Tue Apr 17, 2012 8:55 pm Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
It seems as if the OP is posting all his message sets so that we figure out the parsing (rules) for him... anyway... it is interesting.
Probably ask for a single character (indicator):
Code: |
H|f1|f2|f3|
L|f1|..|f17|
..
L|f1|..|f17|
T|f1|f2|f3|
..
T|f1|f2|f3| |
But: Some systems just have an (immutable) interface so parsers should/need really have to be able to deal with any sort of (or at least 'somewhat reasonably defined') interface (... I guess )
With reg expressions you can give a reg exp on the complex structure level and one on each field level. The one on the complex structure level (Header, Line, Trailer) should be able to detect the type (Header, Line, Trailer ... even if the "indicator" (which mapa suggests) is missing), (e.g. ".{5}|.{5}|.{5}|" for trailer)... each field is then just ".{5}"... The delimiter is e.g. "<CR><LF>" (for Windows) for the complex structures and pipe "|" on the element-level (or (i hardly remember)... it can also be part of the reg exp... probably "\n").
Others certainly have better suggestions (than using data patterns). _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 18, 2012 12:03 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
mqsiuser is correct - you can model this format using data patterns.
I don't have any better suggestions, except the one on the link that mqsiuser posted. This would be fairly simple using WMB v8 and DFDL. |
|
Back to top |
|
 |
mqsiuser |
Posted: Wed Apr 18, 2012 12:10 am Post subject: |
|
|
 Yatiri
Joined: 15 Apr 2008 Posts: 637 Location: Germany
|
I have spared a thing that gets me into trouble (typically)... it is that reg exp are "greedy" (e.g. read a book on perl (I have the impression that reg exp are meant to work in a certain way and I think they actually do in a UNIX-World (and affiliated)))... so reading about how perl deals with reg expressions will help
So you will likely have variable length fields (and not just fields, which are of length 5 (five)).
So instead of ".{5}", you will have to use ".*" ... but now that is "greedy" and will just run to the end of your message (and then nothing is left to "parse next") ... probably wikipedia can help. _________________ Just use REFERENCEs |
|
Back to top |
|
 |
kimbert |
Posted: Wed Apr 18, 2012 1:27 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
mqsiuser said:
Quote: |
So instead of ".{5}", you will have to use ".*" |
I accept that you are trying to be helpful...but .* is not the solution here. As you rightly say, constructing a regular expression for a line of CSV data is not trivial. Fortunately, others have already done it, so Mr Google will probably be able to assist. |
|
Back to top |
|
 |
Broker |
Posted: Thu Apr 19, 2012 6:34 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
[MRM won't know that it doesn't have 16 until it's failed to find 4.]
Ya that's true but by using tag and sequence we will be able to differentiate them but the problem is I donot have a tag here[/quote] |
|
Back to top |
|
 |
Broker |
Posted: Thu Apr 19, 2012 6:38 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
[quote]It seems as if the OP is posting all his message sets so that we figure out the parsing (rules) for him.[/quote]
The interfaces I am working for are all message set based and I have not dealt with them before, So I have a problem working on them.Sorry for that. |
|
Back to top |
|
 |
Broker |
Posted: Thu Apr 19, 2012 6:49 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
[quote="mqsiuser"]It seems as if the OP is posting all [url=http://www.mqseries.net/phpBB2/viewtopic.php?t=60683&postdays=0&postorder=asc&start=0]his message sets[/url] so that we figure out the parsing (rules) for him... anyway... it is interesting.
Probably ask for a [u]single[/u] character (indicator):
[code]H|f1|f2|f3|
L|f1|..|f17|
..
L|f1|..|f17|
T|f1|f2|f3|
..
T|f1|f2|f3|[/code]
But: Some systems just have an (immutable) interface so parsers should/need really have to be able to deal with any sort of (or at least 'somewhat reasonably defined') interface (... I guess )
With reg expressions you can give a reg exp on the [i]complex structure[/i] level and one on each [i]field[/i] level. The one on the complex structure level (Header, Line, Trailer) should be able to detect the type (Header, Line, Trailer ... even if the "indicator" (which mapa suggests) is missing), (e.g. ".{5}|.{5}|.{5}|" for trailer)... each field is then just ".{5}"... The delimiter is e.g. "<CR><LF>" (for Windows) for the complex structures and pipe "|" on the element-level (or (i hardly remember)... it can also be part of the reg exp... probably "\n").
Others certainly have better suggestions ([url=http://www.mqseries.net/phpBB2/viewtopic.php?p=326915&highlight=#326915]than using data patterns[/url]).[/quote]
Its not easy for me to get the input message changed. So I tried using Data pattern for which I gave it as
Messages
Thirdpayment
sequence
Header
......respective Fields....
sequence
Body
......respective Fields....
sequence
Trailer
......respective Fields....
I specified it's Properties as
Third payment:DataElement seperation: All Elements Delimited
Delimiter: |<CR><LF>
For all sequence: DataElement separation: Use Data Pattern
For Header, Body, trailer: All Elements Delimited
And
Data patterns as u specified as:
Header: .{1}|.{8}|.{6}|
Body: {12}|.{12}|.{1}|.{6}|.{16}|.{16}|.{8}|.{8}|.{8}|.{8}|.{13}|.{9}|.{4}|.{5}|.{13}.{9}|.{13}|
trailer:.{5}|.{13}|.{13}|
And I am getting this exception:ImbRecoverableException caught from worker->parseNext. Where am I going Wrong? |
|
Back to top |
|
 |
kimbert |
Posted: Thu Apr 19, 2012 7:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
That error is *not* the only diagnostic info available to you. Did you really think that it was? Look in the Windows Event Viewer, or take a user trace, or look in the system log if on Unix/Linux.
Ideally, take a debug-level user trace and post the result. In [ c o d e ] tags. And please use the Preview button this time before hitting Submit  |
|
Back to top |
|
 |
Broker |
Posted: Thu Apr 19, 2012 8:12 am Post subject: |
|
|
Novice
Joined: 19 Mar 2012 Posts: 22
|
This is the whole Exception.
[code]
RecoverableException
File:CHARACTER:/build/S700_P/src/DataFlowEngine/ImbMqOutputNode.cpp
Line:INTEGER:905
Function:CHARACTER:ImbMqOutputNode::evaluate
Type:CHARACTER:ComIbmMQOutputNode
Name:CHARACTER:BankDraft#FCMComposite_1_2
Label:CHARACTER:BankDraft.MQ Output
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:2230
Text:CHARACTER:Caught exception and rethrowing
ParserException
File:CHARACTER:/build/S700_P/src/MTI/MTIforBroker/MtiImbParser2/MtiImbParser.cpp
Line:INTEGER:2676
Function:CHARACTER:MtiImbParser::parse_remaining
Type:CHARACTER:ComIbmMQInputNode
Name:CHARACTER:BankDraft#FCMComposite_1_1
Label:CHARACTER:BankDraft.MQ Input
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5285
Text:CHARACTER:ImbRecoverableException caught from worker->parse.
Insert
Type:INTEGER:5
Text:CHARACTER:Test_Scott
Insert
Type:INTEGER:2
Text:CHARACTER:1
Insert
Type:INTEGER:5
Text:CHARACTER:CSV
Insert
Type:INTEGER:5
Text:CHARACTER:/THIRD_PYMT
ParserException
File:CHARACTER:/build/S700_P/src/cpi/pwf/nxd/nxdworker.cpp
Line:INTEGER:462
Function:CHARACTER:NXDWorker::parseNext
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:1
Number:INTEGER:5421
Text:CHARACTER:TDS General Error
Insert
Type:INTEGER:5
Text:CHARACTER:THIRD_PYMT
Insert
Type:INTEGER:5
Text:CHARACTER:/THIRD_PYMT/[SEQUENCE]
Insert
Type:INTEGER:2
Text:CHARACTER:8
ParserException
File:CHARACTER:/build/S700_P/src/cpi/pwf/nxd/nxddatapattern.cpp
Line:INTEGER:377
Function:CHARACTER:NXDDataPattern::getMarkupFollowingComplexItem
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5604
Text:CHARACTER:Missing markup following a complex child or group
Insert
Type:INTEGER:5
Text:CHARACTER:[SEQUENCE]
[/code] |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Apr 19, 2012 8:25 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
So it found an end of group and did not find the necessary stuff to start the next group, and the group that ended was not sufficient to end the message. |
|
Back to top |
|
 |
|