Author |
Message
|
DP1234 |
Posted: Wed Oct 15, 2014 9:36 am Post subject: Issue in Defining DFDL Parser for a scenario |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
Hi All
Am trying to create a parser for the below scenario
HeaderASampleTrailer
HeaderBSampleXTrailer
HeaderCSampTrailer
First 6 character are related to Header
After 6 character
if Starts with "A" next 6 character is payload and beyond that is trailer
if Starts with "B" next 7 character is payload and beyond that is trailer
if Starts with "C" next 4 character is payload and beyond that is trailer
(These are just random numbers which am using to explain scenario)
My question is
Which is efficient way to create a parser for above scenario.?
Is it possible to create a DFDL parser for this scenario.?
Am trying to create DFDL parser for same...in Length option am using "XPATH Expression Builder" to define certain function
to implement above logic...is it possible to create using this process?
Searched in IBM website aswell forum regarding "XPATH Expression Builder" didn't find one...
can anybdy help in defining 'IF ELSE' logic in expression builder
Please Help, Thanks |
|
Back to top |
|
|
mqjeff |
Posted: Wed Oct 15, 2014 9:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
In MRM this would be tagged-fixed length data, with each of the A,B,C being in a choice.
structurally something like
Code: |
Message
sequence
Header - fixed length 6
sequence
choice
ARecord - tag 'A'
sequence
....
BRecord - tag 'B'
sequence
....
.... |
In DFLD these are initiators, not tags. |
|
Back to top |
|
|
Vitor |
Posted: Wed Oct 15, 2014 9:46 am Post subject: Re: Issue in Defining DFDL Parser for a scenario |
|
|
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DP1234 wrote: |
can anybdy help in defining 'IF ELSE' logic in expression builder |
Why do you need this? To me, your model (using your posted example and accepting this simply illustrates the issue) looks like:
Item - fixed length 6 character header
Item - Identity A, fixed length 6 character field, field until end of data
Item - Identity B, fixed length 7 character field, field until end of data
Item - Identity C, fixed length 4 character field, field until end of data
So all you need is 3 descriptions in DFDL for the 3 possible item types, and a way to identify which is which (A,B or C) and a description of your header.
Sorted. Even if A,B & C have significantly more complex structures. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
|
DP1234 |
Posted: Wed Oct 15, 2014 10:43 am Post subject: Re: Issue in Defining DFDL Parser for a scenario |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
Vitor wrote: |
DP1234 wrote: |
can anybdy help in defining 'IF ELSE' logic in expression builder |
Why do you need this? To me, your model (using your posted example and accepting this simply illustrates the issue) looks like:
Item - fixed length 6 character header
Item - Identity A, fixed length 6 character field, field until end of data
Item - Identity B, fixed length 7 character field, field until end of data
Item - Identity C, fixed length 4 character field, field until end of data
So all you need is 3 descriptions in DFDL for the 3 possible item types, and a way to identify which is which (A,B or C) and a description of your header.
Sorted. Even if A,B & C have significantly more complex structures. |
Bolded Part is wat am not able to achieve as am working on DFDL for first time. |
|
Back to top |
|
|
Vitor |
Posted: Wed Oct 15, 2014 10:50 am Post subject: Re: Issue in Defining DFDL Parser for a scenario |
|
|
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DP1234 wrote: |
Bolded Part is wat am not able to achieve as am working on DFDL for first time. |
Start here _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
|
kimbert |
Posted: Thu Oct 16, 2014 4:05 am Post subject: |
|
|
Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
No time to reply in detail now, but there are two posts that discuss this. Search for 'DFDL body trailer discriminator' and you should find them. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
|
DP1234 |
Posted: Thu Oct 16, 2014 11:32 pm Post subject: |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
I've achieved most of the part in developing DFDL parser for above scenario...thanks for the link vitor
Now am stuck in looping over all payload elements
DFDL parser looks like
Header
Payload
sequence
A
B
Trailer
Ideally Payload has to occur only once under which all c1,E3 should appear though declared in any order
am not able loop over properly
say data is in format Header,Adata,Bdata,Adata,Adata,Adata,Bdata,Trailer
If i make payload as unbounded
i get structure like
Header
payload
A
B
payload
A
A
A
B
Trailer
if payload max occurs is 1 (ideally t has to be 1)
Header
payload
A
B
Trailer
am facing issue here in looping over
Can anybdy tell correct way to loop over and get all payload data in one tag |
|
Back to top |
|
|
DP1234 |
Posted: Fri Oct 17, 2014 4:03 am Post subject: |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
this is how need the data to appear
Header
payload
A
B
A
A
A
B
Trailer |
|
Back to top |
|
|
Vitor |
Posted: Fri Oct 17, 2014 4:51 am Post subject: |
|
|
Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
DP1234 wrote: |
Can anybdy tell correct way to loop over and get all payload data in one tag |
Why are you trying to loop through the model? Why not read the records as records, and assemble the data into the output as required.
It's probably possible to twist DFDL into doing this. It's almost certainly better to actually write some code to do this. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
|
DP1234 |
Posted: Fri Oct 17, 2014 5:10 am Post subject: |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
Vitor wrote: |
DP1234 wrote: |
Can anybdy tell correct way to loop over and get all payload data in one tag |
Why are you trying to loop through the model? Why not read the records as records, and assemble the data into the output as required.
It's probably possible to twist DFDL into doing this. It's almost certainly better to actually write some code to do this. |
Thanks for reply vitor
Is it really possible to get output like this by anyway
Header
payload
A
B
A
A
A
B
Trailer
Currently am getting like this
Header
payload
A
B
payload
A
A
A
B
Trailer |
|
Back to top |
|
|
fjb_saper |
Posted: Fri Oct 17, 2014 5:22 am Post subject: |
|
|
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20729 Location: LI,NY
|
OK. So what you need to define is:
Header -- min 1 max 1
Payload --min 1 max 1
sequence -- min 1 max unbounded
A -- min 1 max 1
B -- min 0 max 1
Trailer -- min 1 max 1
Have fun with it _________________ MQ & Broker admin |
|
Back to top |
|
|
kimbert |
Posted: Fri Oct 17, 2014 5:31 am Post subject: |
|
|
Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Probably best if you do this:
1. Provide an example input message.
2. Provide an example message tree structure for the input message. Please use [c o d e] tags so that we can see the structure clearly.
3. Post your DFDL xsd, or else describe its structure clearly.
I can understand your requirements ( sort of ) but I don't want to give advice based on partial info. _________________ Before you criticize someone, walk a mile in their shoes. That way you're a mile away, and you have their shoes too. |
|
Back to top |
|
|
DP1234 |
Posted: Fri Oct 17, 2014 7:48 am Post subject: |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
fjb_saper wrote: |
OK. So what you need to define is:
Header -- min 1 max 1
Payload --min 1 max 1
sequence -- min 1 max unbounded
A -- min 1 max 1
B -- min 0 max 1
Trailer -- min 1 max 1
Have fun with it |
we Cant set sequence as unbounded...DFDL doesnt lets to do this i believe
Last edited by DP1234 on Fri Oct 17, 2014 8:33 am; edited 1 time in total |
|
Back to top |
|
|
DP1234 |
Posted: Fri Oct 17, 2014 8:04 am Post subject: |
|
|
Apprentice
Joined: 25 May 2014 Posts: 40
|
kimbert wrote: |
Probably best if you do this:
1. Provide an example input message.
2. Provide an example message tree structure for the input message. Please use [c o d e] tags so that we can see the structure clearly.
3. Post your DFDL xsd, or else describe its structure clearly.
I can understand your requirements ( sort of ) but I don't want to give advice based on partial info. |
Sample input message
Code: |
EDDF4566855555555555A45896B5666A45896A45896B566600000
Here
Header: EDDF4566855555555555
A Data (Initiator A Length 5) : 45896
B Data (Initiator B Length 4) : 5666
Trailer: 00000
|
Data can appear any times any order
Currently i achieved to get tree structure like
Code: |
Header
EDDF4566855555555555
Record
A
45896
Record
B
5666
Record
A
45896
Record
A
45896
Record
B
5666
Trailer
00000
|
Which is the best tree structure can we create for this type of data structure |
|
Back to top |
|
|
fjb_saper |
Posted: Fri Oct 17, 2014 12:55 pm Post subject: |
|
|
Grand High Poobah
Joined: 18 Nov 2003 Posts: 20729 Location: LI,NY
|
DP1234 wrote: |
fjb_saper wrote: |
OK. So what you need to define is:
Header -- min 1 max 1
Payload --min 1 max 1
sequence -- min 1 max unbounded
A -- min 1 max 1
B -- min 0 max 1
Trailer -- min 1 max 1
Have fun with it |
we Cant set sequence as unbounded...DFDL doesnt lets to do this i believe |
So create a repetitive payloaditem complex type with the sequence.
Code: |
Header
Payload
PayloadItem (1 to n)
sequence
A min 1
B min 0
Trailer |
as long as your structure matches the data you're all good _________________ MQ & Broker admin |
|
Back to top |
|
|
|