Author |
Message
|
max power |
Posted: Thu Aug 15, 2013 7:32 am Post subject: ASBITSTREAM error |
|
|
Apprentice
Joined: 06 Sep 2007 Posts: 31
|
I have data in the Environment Tree in the following format:
Environment
Data
DataRecord
Data
datarec 12345,12345,AAABBCC001
datarec 56789,56789,AAABBCC002
datarec 24680,24680,AAABBCC003
I want to add all of the 'datarec' lines to a single message before sending to the output node.
I am trying the ASBITSTREAM function to do this.
The esql I have is this:
Code: |
DECLARE record BLOB;
MOVE dataRef TO Environment.Data.DataRecord.Data;
SET record = ASBITSTREAM(dataRef ENCODING 546 CCSID 1208 OPTIONS RootBitStream SET 'I4F7REK002001' TYPE 'Message' FORMAT 'Text1' );
|
I have created a message set with the message type of 'Message' and this contains just one element 'datarec' (type = xsd:string)
When running the ASBITSTREAM function, I receive the following error in the UserTrace:
Code: |
UserTrace BIP6068W: A request was made to serialize a bitstream from element ''data'' using parser ''MQROOT''. The result was zero bytes long.
The node or ESQL ASBITSTREAM function requested that an element serialize its bitstream and this resulted in no bytes being written.
If the output bitstream should not have been zero bytes long, ensure that the correct element was specified.
If the parser name is blank or set to a root parser, associate an owning parser with the element:
If created in ESQL, the DOMAIN clause of the CREATE statement can be used.
If created using the user-defined extension API use a method that allows a parser to be specified.
|
Does anyone know what I might be doing wrong? |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 15, 2013 7:40 am Post subject: Re: ASBITSTREAM error |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
max power wrote: |
I have data in the Environment Tree in the following format:
Environment
Data
DataRecord
Data
datarec 12345,12345,AAABBCC001
datarec 56789,56789,AAABBCC002
datarec 24680,24680,AAABBCC003
I want to add all of the 'datarec' lines to a single message before sending to the output node.
I am trying the ASBITSTREAM function to do this.
The esql I have is this:
Code: |
DECLARE record BLOB;
MOVE dataRef TO Environment.Data.DataRecord.Data;
SET record = ASBITSTREAM(dataRef ENCODING 546 CCSID 1208 OPTIONS RootBitStream SET 'I4F7REK002001' TYPE 'Message' FORMAT 'Text1' );
|
I have created a message set with the message type of 'Message' and this contains just one element 'datarec' (type = xsd:string)
When running the ASBITSTREAM function, I receive the following error in the UserTrace:
Code: |
UserTrace BIP6068W: A request was made to serialize a bitstream from element ''data'' using parser ''MQROOT''. The result was zero bytes long.
The node or ESQL ASBITSTREAM function requested that an element serialize its bitstream and this resulted in no bytes being written.
If the output bitstream should not have been zero bytes long, ensure that the correct element was specified.
If the parser name is blank or set to a root parser, associate an owning parser with the element:
If created in ESQL, the DOMAIN clause of the CREATE statement can be used.
If created using the user-defined extension API use a method that allows a parser to be specified.
|
Does anyone know what I might be doing wrong? |
To start with, you have not explained very well what you want to do, so that is the first thing you have done wrong.
you want to output a message, what kind of message ? do you have a message definition for it or is it xml ?
Do you know what the ASBITSTREAM function does ?, why are you using it ? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Aug 15, 2013 7:41 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
The tree in Environment has no parser associated with it. |
|
Back to top |
|
 |
max power |
Posted: Thu Aug 15, 2013 7:50 am Post subject: Re: ASBITSTREAM error |
|
|
Apprentice
Joined: 06 Sep 2007 Posts: 31
|
dogorsy wrote: |
To start with, you have not explained very well what you want to do, so that is the first thing you have done wrong.
you want to output a message, what kind of message ? do you have a message definition for it or is it xml ?
Do you know what the ASBITSTREAM function does ?, why are you using it ? |
The individual rows need to be concatenated into a single record and then converted to Base64 before sending to a web service in an XML tag.
I am using the ASBITSTREAM function to create a BLOB which will then be CAST to a CHAR before being Base64 encoded.
mqjeff - I assume I will have to associate a parser to the tree before doing the above..? |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Aug 15, 2013 7:53 am Post subject: Re: ASBITSTREAM error |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
max power wrote: |
dogorsy wrote: |
To start with, you have not explained very well what you want to do, so that is the first thing you have done wrong.
you want to output a message, what kind of message ? do you have a message definition for it or is it xml ?
Do you know what the ASBITSTREAM function does ?, why are you using it ? |
The individual rows need to be concatenated into a single record and then converted to Base64 before sending to a web service in an XML tag.
I am using the ASBITSTREAM function to create a BLOB which will then be CAST to a CHAR before being Base64 encoded.
mqjeff - I assume I will have to associate a parser to the tree before doing the above..? |
ASBITSTREAM function is the step AFTER you assign the row values to an XMLNSC structure.
You are using ASBITSTREAM prematurely. _________________ http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER |
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 15, 2013 8:04 am Post subject: Re: ASBITSTREAM error |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
max power wrote: |
dogorsy wrote: |
To start with, you have not explained very well what you want to do, so that is the first thing you have done wrong.
you want to output a message, what kind of message ? do you have a message definition for it or is it xml ?
Do you know what the ASBITSTREAM function does ?, why are you using it ? |
The individual rows need to be concatenated into a single record and then converted to Base64 before sending to a web service in an XML tag.
I am using the ASBITSTREAM function to create a BLOB which will then be CAST to a CHAR before being Base64 encoded.
mqjeff - I assume I will have to associate a parser to the tree before doing the above..? |
Your data is already in char format, all you need to do is concatenate and then convert to base 64 using the appropriate ESQL function ( look in the infocenter and you will find one ). |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 15, 2013 10:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I agree with dogorsy. Using a message set is buying you nothing in this case. Do it like this:
- write a FOR loop in ESQL that concatenates the rows into a single CHARACTER variable.
- convert the CHARACTER variable to a BLOB using CAST. Do not forget to carefully choose the CCSID when casting.
- convert the BLOB to base64 using the appropriate ESQL function _________________ 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 |
|
 |
dogorsy |
Posted: Thu Aug 15, 2013 11:15 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
Quote: |
convert the CHARACTER variable to a BLOB using CAST. Do not forget to carefully choose the CCSID when casting.
|
don't even need to do this step, the esql function manipulates all string data types (BIT, BLOB, and CHARACTER), now the OP needs to do a bit of searching and find the appropriate function, which is not as well documented as all other string functions ( missing in a few places, so raised a feedback comment to get it updated ). |
|
Back to top |
|
 |
kimbert |
Posted: Thu Aug 15, 2013 12:54 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
|
Back to top |
|
 |
dogorsy |
Posted: Thu Aug 15, 2013 10:22 pm Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
yes, you are right Tim, but if you search with 'string manipulation' the base 64 functions are not listed... |
|
Back to top |
|
 |
kimbert |
Posted: Fri Aug 16, 2013 12:25 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Well...it's debatable whether BASE64ENCODE and BASE64DECODE are 'string manipulation' functions. They don't modify or create a string. They convert between BLOB and CHARACTER forms of a byte array. _________________ 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 |
|
 |
dogorsy |
Posted: Fri Aug 16, 2013 12:43 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
kimbert wrote: |
Well...it's debatable whether BASE64ENCODE and BASE64DECODE are 'string manipulation' functions. They don't modify or create a string. They convert between BLOB and CHARACTER forms of a byte array. |
hmmm..... yes, I think you are right !.. the uuid functions are not in the list either, and they should not. My mistake.
yes, there is a section for "Miscellaneous ESQL functions" they are all there. Committed the offence that I always complain about, not doing my own research ! 
Last edited by dogorsy on Fri Aug 16, 2013 1:05 am; edited 1 time in total |
|
Back to top |
|
 |
max power |
Posted: Fri Aug 16, 2013 12:59 am Post subject: |
|
|
Apprentice
Joined: 06 Sep 2007 Posts: 31
|
Thanks for the replies folks.
The Base64 encoding is the easy part but I think I was just trying to over-complicate things by creating a message set and then trying to convert the data.
I'll just do as suggested and create a large concatenated string and convert from there. |
|
Back to top |
|
 |
smdavies99 |
Posted: Fri Aug 16, 2013 1:14 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
dogorsy wrote: |
Committed the offence that I always complain about, not doing my own research !  |
As it is a Friday, I think you owe us a Beer!  _________________ 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 |
|
 |
dogorsy |
Posted: Fri Aug 16, 2013 1:18 am Post subject: |
|
|
Knight
Joined: 13 Mar 2013 Posts: 553 Location: Home Office
|
smdavies99 wrote: |
dogorsy wrote: |
Committed the offence that I always complain about, not doing my own research !  |
As it is a Friday, I think you owe us a Beer!  |
no prob. Slate in the Dolphinin the name of M. Golby-K
Only joking, I will pop run sometime and will send a proper invite |
|
Back to top |
|
 |
|