|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using DFDL to create a structure |
« View previous topic :: View next topic » |
Author |
Message
|
gfrench |
Posted: Tue Nov 21, 2023 2:32 am Post subject: Using DFDL to create a structure |
|
|
 Acolyte
Joined: 10 Feb 2002 Posts: 71
|
I have a simple DFDL and which has a sequence
ACK_Indicator, 1 character string, either a '0' or '1'
Choice (choice dispatch key ACK_Indicator)
ACK string, fixed value 'ACK' (choice branch key 0)
NACK. string, fixed value 'NACK' (choice branch key 1)
I want to use this to build a structure, that if I set the ACK_Indicator = 0 I get the ACK element and if I set ACK_Indicator = 1 I get the NACK element
When I use Choice Dispatch Key set to point to the ACK_Indicator it seems it correctly parses either the ACK or NACK elements correctly based on the Choice Branch
When constructing a message it works and dynamically creates the ACK when I set 0 but not for NACK. If I put the NACK element above the ACK it works for NACK and not ACK.
Does Choice Dispatch Key only work for parsing?
Second question, is can i dynamically create a time field with the CURRENT_TIMESTAMP in it?
I think I am going to have to resort to ESQL, but thought I would just check if someone has more experience of DFDL, as documentation is a little sketchy.
Thanks |
|
Back to top |
|
 |
timber |
Posted: Wed Nov 22, 2023 4:30 am Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Would you mind supplying an example input document and the resulting message tree?
Quote: |
Does Choice Dispatch Key only work for parsing? |
Correct - as far as I remember, it's an optimisation for parsing only. When writing, you need to use outputValueCalc to calculate the value of the ACK_Indicator field based on the contents of the message tree.
Quote: |
can i dynamically create a time field with the CURRENT_TIMESTAMP in it? |
Where do you want to create it? Obviously, you can easily create a field in the message tree and set its value using CURRENT_TIMESTAMP. But you probably know that already  |
|
Back to top |
|
 |
gfrench |
Posted: Fri Nov 24, 2023 7:00 am Post subject: |
|
|
 Acolyte
Joined: 10 Feb 2002 Posts: 71
|
Sorry for slow reply..and thanks for response
I will play around and see if I can work out how to use OutputValueCalc.
The date I wanted to create as a default value in the output from the DFDL.
Basically I have a fixed length field structure (used comma below easier to demo it) which I need to build and add into an XML field. Some fields can be defaulted, some fields need setting. I could just set OutputRoot.XMLSC...myfield = 'ACK,00,20231124', however the structure has a few more fields so I would like to set just the second field 00, then bitstream the DFDL to defult the other values. If 00 then ACK, if 01 then NACK.
I think DFDL works better at parsing than constructing, but will play around some more. thanks |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|