Author |
Message
|
WBI_user |
Posted: Mon Oct 29, 2007 8:27 pm Post subject: Need help on ASBITSTREAM |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
In the middle of my message flow (i.e. I have already modified the original input message) I want to capture a blob image of the mesage. In the previous version, I just do
set MYBLOBMSG=BITSTREAM("InputBody")
Now I am on V6 with CSD 5, the books says that BITSTREAM Is deprecated and I should use ASBITSTREAM
So I change it to
SET BLOBMSG= ASBITSTREAM("InputBody" CCSID inCCSID Encoding inENC); where inCCSID and inENC is the CCSID and Ecoding value from the MQMD of my incoming message.
Howver this failed with BIP5136E: Invalid Wire Format Identifier when the message format is MRM.
I then change it to
SET BLOBMSG= ASBITSTREAM("InputBody" OPTIONS EmbeddedBitStream);
Now I got parser exception because my message does not match with the message type defined in MRM. Trace shows that it is using the message type and message format to parse my message which I have already modified. So I got exceptions like the bitstream is larger than specified or something along that line dpending on what I have changed in previous compute nodes.
I then tried SET BLOBMSG= ASBITSTREAM("InputBody" OPTIONS RootBitStream); But got similar errros.
MYBLOBMSG=BITSTREAM("InputBody") still works fine in V6. Can anyone help me on how I can move from the deprecated bitstream function to the newer ASBITSTREAM ? |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 30, 2007 1:29 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Have you read the docs for ASBITSTREAM?
Have you searched this forum for 'ASBITSTREAM'. There are dozens of posts dealing with this subject.
I'd like to help a little more, but I can't work out what you're trying to do. Are you trying to output an XML bitstream, or a non-XML bitstream? Do you want to output it using the MRM parser, or some other parser?
If you have modified your message tree since it was parsed, then you cannot expect the MRM parser to 'automatically' work out how to output your modified message tree using the original message type. You need to have a message type which matches the tree you are outputting. |
|
Back to top |
|
 |
WBI_user |
Posted: Tue Oct 30, 2007 4:52 am Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
There is a portion of the message which my clients puts whatever they want in there. It may be a description of the product or it may be a binary data such as jpeg file. The incoming message can be xml or cwf or TDS described by MRM. If it is CWF, there is a maximum size for that field. I have a need to store this portion for later use. I read the infocenter on ASBITSTREAM. I can see a reason why IBM is moving from BITSTREAM to ASBITSTREAM and I think, if I understand correctly, it is the parser that is associated with the field doing the bitstream conveersion. In V2, I used BITSTREAM for another application with similar requirement and it seems that things are done magically. I do not have to worry about what parse or what message type. I did not try to understand how and why at V2 because it works. In V6, as described by the doc, I have to specify ccsid, encoding, message set, type and format or use Rootbitstream or embeddedbitstream.
I may not understand this correctly. In my case, the message is already modified from the input message in the previous node. When coming into my compute node (this may become a subflow in the future), the body of the message only contains the data that I want to capture. So I really do not have any message set type or format to describe the message. So I only specified CCSID and Encoding. But it failed with BIP5136E. So I tried the different cases described in my first post.
I hope I have explained my requirement properly. Any further advice will be greatly appreciated. |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 30, 2007 5:03 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Just try using ASBITSTREAM(InputBody).
Really! _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
WBI_user |
Posted: Tue Oct 30, 2007 12:36 pm Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
Just test it again with ASBITSTREAM(InputBody). it failed with BIP5136E: Invalid Wire Format Identifier |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 30, 2007 2:36 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Thanks for the clarifications. Answers follow:
Quote: |
In V2, I used BITSTREAM for another application with similar requirement and it seems that things are done magically. |
The requirement must have been much simpler. BITSTREAM did not contain any magic.
Quote: |
I think, if I understand correctly, it is the parser that is associated with the field doing the bitstream conversion. |
Correct. All bitstream <-> message tree conversions are performed by a parser.
Quote: |
In my case, the message is already modified from the input message in the previous node. When coming into my compute node (this may become a subflow in the future), the body of the message only contains the data that I want to capture. So I really do not have any message set type or format to describe the message. |
If the message tree is a subset of the original message tree, then you may be able to use FolderBitstream mode. You must specify the message set/type/format info, though! You will need to specify Type as a path from the root of the message type ( e.g. instead of 'myMessageType' you will need 'myMessageType/parentElement/childElement/elementToSerialize' )
Quote: |
it failed with BIP5136E: Invalid Wire Format Identifier |
The specified message set did not contain the specified physical format. You probably mistyped one or other ( a common mistake is to specify 'XML' instead of 'XML1' ) |
|
Back to top |
|
 |
WBI_user |
Posted: Tue Oct 30, 2007 8:41 pm Post subject: |
|
|
Partisan
Joined: 07 Aug 2001 Posts: 386
|
Thanks Kimbert, as I mentined, the compute node that I am writing will very likely become a subflow which just store some data as binary for future reuse. That's why I am trying to use ASBITSTREAM. So it may or may not be a subset of the original inout message depending on what modification has done before it reaches my compute node. You said "You must specify the message set/type/format info" so I have some difficulties in determining what message set/type/format to give to the ASBITSTREAM function. My requirement is actually very simple to just store the body or a protion of the body of the message as BLOB regardless of what wire format or message format the data is in. Is there any easier way than using ASBITSTREAM ? |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 31, 2007 4:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Yes, there's an easier way to do this.
Use an RCD node to reset the content to BLOB.
But, again. The RCD node will have to know what message set/parser/etc. the message tree is currently represented by. This will have to be correctly set on the Properties subtree before it gets to the RCD node. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Oct 31, 2007 4:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Yes, there's an easier way to do this. |
It depends what you mean by 'easier'. If WBI_user is dealing with a wide range of different input message formats, I wouldn't like to write the ESQL to parse that BLOB
Quote: |
My requirement is actually very simple to just store the body or a portion of the body of the message as BLOB regardless of what wire format or message format the data is in. Is there any easier way than using ASBITSTREAM ? |
Using ASBITSTREAM is not hard - you just need to supply the information that the parser requires. If you don't use ASBITSTREAM you will need to supply exactly the same information as input to some other ( very complicated ) ESQL procedure. There's no such thing as a free lunch.
Summary : Your requirement is not simple at all. Using ASBITSTREAM is probably the easiest way to meet the requirement. |
|
Back to top |
|
 |
|