Author |
Message
|
adamd |
Posted: Fri Dec 04, 2015 11:51 am Post subject: How to Serialize DFDL in compute node |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
Hello,
I am very new to IIB and am trying to figure out how I would take a DFDL message from and input node and re serialize it back to its original state as a string. I would like to do this in .net if possible. My scenario is this, I have created a DFDL for a cobol copybook that I am doing some pre processing on in a .net compute node and would like to be able to take this DFDL and write its contents back out to a file in another location. Again I am very new to this technology and appreciate any help or direction anyone has to offer. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Dec 04, 2015 12:05 pm Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Why do you want to do this?
Constructing message trees from the input message is one of the huge plus points for this product. Unlike say, Java you work with the tree after the input has been parsed.
Normally, you only serialise the data when the transformed message is output from the flow. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
adamd |
Posted: Fri Dec 04, 2015 12:21 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
I need to do this because our cobol application expects the file in the serialized format as input(it watches for the actual file in a directory), but I need to intercept the file first to determine if this customer matches a certain criteria and then generate the order number before hand to be tracked in a display system. . If the customer doesn't match then it's a normal order and I don't have to pre generate an order number. Unfortunately I don't have any other way to get the order in the cobol system except for this file. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Dec 04, 2015 12:24 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
So why don't you let the FileOutput node serialize the DFDL?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 04, 2015 12:29 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
adamd wrote: |
I need to do this because our cobol application expects the file in the serialized format as input(it watches for the actual file in a directory), but I need to intercept the file first to determine if this customer matches a certain criteria and then generate the order number before hand to be tracked in a display system. . If the customer doesn't match then it's a normal order and I don't have to pre generate an order number. Unfortunately I don't have any other way to get the order in the cobol system except for this file. |
So you need to read a file with the DFDL model you've built, examine this order number field, do what you do and write the file back out with this new order number or not.
Why do you need to serialize the content? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
adamd |
Posted: Fri Dec 04, 2015 12:33 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
@fjb_saper - I'll try the file output node, thanks for the suggestion.
@Vitor - I guess I thought I had to serialize the DFDL message to get it back into its original form, if there is another way to get the file contents in their original state I'm all for that. |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Dec 04, 2015 12:39 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Let the broker do it. _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 04, 2015 12:45 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
adamd wrote: |
@fjb_saper - I'll try the file output node, thanks for the suggestion.
@Vitor - I guess I thought I had to serialize the DFDL message to get it back into its original form, if there is another way to get the file contents in their original state I'm all for that. |
Given that you're reading the file with a FileInput node, the existence of a FileOutput node should have been a clue.
You are reading the file with a FileInput node, aren't you.....?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
adamd |
Posted: Fri Dec 04, 2015 12:59 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
Yes, I am reading the file with a file input node. Someone told me that in order to save or read files from a network location it required an add on that we do not have but I will do some more checking. Like I originally stated I am very new to this technology and this is my first try at creating something with it and unfortunately I don't have anyone in my organization that has any experience with this either (everyone has left or been let go... long story). So I am trying to figure this out between the ibm docs and google - which brought me to this site. I guess for the experienced my questions may seem absurd and for that I am sorry, I am just trying to learn how all this stuff works. |
|
Back to top |
|
 |
Vitor |
Posted: Fri Dec 04, 2015 1:18 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
adamd wrote: |
Someone told me that in order to save or read files from a network location it required an add on that we do not have but I will do some more checking. |
adamd wrote: |
I don't have anyone in my organization that has any experience with this either |
I would assert that these 2 statements are at variance. Either this someone knows enough about IIB to comment on how it works with network storage or they don't. If they do, they can help you with this problem; if not, they shouldn't offer an opinion.
Based entirely on that opinion, they shouldn't offer any further ones.
adamd wrote: |
I am just trying to learn how all this stuff works. |
And this is absolutely the worst way to do it. Seriously. We're not set up as a training area and really can't deliver the kind of broad based knowledge needed. I urge you to push back at whoever gave you this task and impress upon them the importance of formal training (CBT, classroom, etc) and/or some on-site mentoring from someone brought in on a contract to help you. Experimentation is all good and well, but it needs to be backed up.
They can't just throw you in the deep end and expect you to deliver with nothing but the advice of some random strangers on the Internet. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
adamd |
Posted: Fri Dec 04, 2015 1:24 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
Well I think I answered my own question after digging through the IBM docs some more and came up with using the AsBitStream method and writing that out to a file. Thanks for the replies. |
|
Back to top |
|
 |
adamd |
Posted: Fri Dec 04, 2015 1:27 pm Post subject: |
|
|
Newbie
Joined: 04 Dec 2015 Posts: 6
|
Vitor, I agree with you 100% and I appreciate you taking the time to chat with me. It really means a lot that a random stranger would take the time to offer advice on something like this. I am working on getting some training lined up but it is not for another month yet. |
|
Back to top |
|
 |
timber |
Posted: Fri Dec 04, 2015 1:55 pm Post subject: |
|
|
 Grand Master
Joined: 25 Aug 2015 Posts: 1292
|
Quote: |
We're not set up as a training area and really can't deliver the kind of broad based knowledge needed. |
This is true. All the same, I think I can spot the vital missing piece of the jigsaw in adamd's mind.
In IIB, the message flow logic processes the message tree. It should not ( ideally ) know or care about the format of the input message nor the type of message transport on which it arrived. Same goes for the output format/transport.
The selected parser and ( if applicable ) the model/schemas do all the heavy lifting to convert from the byte array to the internal tree format and vice versa. This happens automatically and on-demand. Working within these constraints takes practice, but it also leads to good, reusable designs. And it's efficient; if your message flow never requires any parsing to happen, none will happen. If your message flow doesn't change the message in any way, the output node will re-use the original byte array.
The ASBITSTREAM statement ( and it's opposite, CREATE...PARSE ) are provided for use in exceptional circumstances. Your circumstances are about as standard as it gets - straight out of the IIB training manual. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Dec 07, 2015 4:56 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
adamd wrote: |
Well I think I answered my own question after digging through the IBM docs some more |
No you didn't.
adamd wrote: |
and came up with using the AsBitStream method and writing that out to a file. |
Despite me mentioning the FileOutput node?
When you get the training, mention this scenario to whoever's doing the training, the solution you came up with and the idea of a "FileOutput" node that some random stranger suggested. See what they say. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|