Author |
Message
|
pdrabik |
Posted: Wed Oct 03, 2007 4:25 am Post subject: REFERENCE to CHARACTER |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Hello, Im trying put whole InputRoot scope into one reference, so as string (character).
by this code:
Code: |
SET OutputRoot.XML.Body.Log = '' ;
WHILE I < J DO
EVAL('SET tmp = FIELDNAME(' || rootname || '.*[I]);');
WHILE II < JJ DO
EVAL ('SET fname = FIELDNAME(' || rootname ||'.*[I].*[II]);');
EVAL( 'SET fval = FIELDVALUE(' || rootname || '.*[I].*[II]);');
SET OutputRoot.XML.Body.Log = OutputRoot.XML.Body.Log || tmp || ':' || fname || ':' || 'value' ||nl;
SET II = II + 1 ; |
Where rootname is usual InputRoot.
This all works fine, it produces something like that:
Properties:MessageSet:value
Properties:MessageType:value ...etc
Yet, instead value it shoudl be the value of that field included.
But, while Im trying to concate this LOG reference with FVAL variable like this:
Code: |
OutputRoot.XML.Body.Log = OutputRoot.XML.Body.Log || tmp || ':' || fname || ':' || fval ||nl; |
it all crashes, with no error. Output looks like this then:
</Body>
What can be the issue ?
Ive been trying to CAST that fval to CHARACTER, no use. FIELDVALUE function either - the same effect (both: FIELDVALUE and CAST either).
Any suggestions ?
Regards _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Oct 03, 2007 4:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You're going a long way down a complicated road that is a lot simpler to avoid entirely.
If you wish to convert an entire message to a string, then use asbitstream and cast the result to character.
If you wish to convert an entire message into a string that is formatted in a particular way, then create an MRM model of the formatted message, populate that, and then use asbitstream...
Do not use EVAL in places where {} is usable.
Don't use the XML domain, use XMLNS or XMLNSC. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Oct 04, 2007 9:41 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
I dont know, somehow ASBITSTREAM and CAST gives me only BLOB  _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Oct 04, 2007 9:47 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi pdrabik,
pdrabik wrote: |
I dont know, somehow ASBITSTREAM and CAST gives me only BLOB  |
Could you paste what you've tried with the ASBITSTREAM...
Regards. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Oct 04, 2007 2:53 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
pdrabik wrote: |
I dont know, somehow ASBITSTREAM and CAST gives me only BLOB  |
Use ASBITSTREAM to get a BLOB. Use the BLOB to CAST to a CHARACTER...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
pdrabik |
Posted: Thu Oct 04, 2007 10:47 pm Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
do u have such a code on ur mind:
Code: |
SET somevariable = CAST ( ASBITSTREAM(some_reference) AS CHARACTER)
|
??
should there be any specific options included with ASBITSTREAM ? _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Oct 05, 2007 1:09 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
|
Back to top |
|
 |
pdrabik |
Posted: Fri Oct 05, 2007 1:21 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
so CCSID InputRoot.Properties.CodedCharSetId option should do the work.. i ll try though.. thx a lot.. i ll update _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
pdrabik |
Posted: Mon Oct 08, 2007 10:15 pm Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Ok Ive analised this:
ydsk wrote: |
Jeff,
Your last suggestion didn't work.
Since we can't modify Root structure in the database node I replaced the database node with a Compute node and inserted the same ESQL ( of course replacing Root with Input/Output Root, and ExceptionList with Input/Output Exceptionist as needed).
Then instead of copying ExceptionList into Environment ( as Environment too doesn't have a parser ) I copied it into OutputRoot as the last child as given below and it finally worked:
Create LASTCHILD of OutputRoot DOMAIN('XML') Name 'XML';
SET OutputRoot.XML.ExceptionList = InputExceptionList;
DECLARE EXCEPTIONBLOB BLOB ASBITSTREAM(OutputRoot.XML.ExceptionList);
DECLARE FULLEXCEPTION CHAR CAST(EXCEPTIONBLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
Thank you all for your inputs. |
yeah and it worked for ExceptionList, thx ydsk .
However, why it doesnt work with InputRoot ?
Code: |
CREATE LASTCHILD of OutputRoot DOMAIN('XML') Name 'Log2';
SET OutputRoot.Log2.XML = rootname;
DECLARE messageBlob BLOB ASBITSTREAM(rootname);
DECLARE messageChar CHAR CAST(messageBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
Set OutputRoot.Log2.XML = messageChar; |
I know it dont work, because it is propagated to Failure terminal, with converter error for value "45.3". Propably from the timestamp. So why is so big problem with converting 45.3 to CHAR
Some option needed with ASBITSTREAM, more options for CAST ? _________________ ---
cc: poltreak@o2.pl
Last edited by pdrabik on Mon Oct 08, 2007 10:29 pm; edited 1 time in total |
|
Back to top |
|
 |
AkankshA |
Posted: Mon Oct 08, 2007 10:28 pm Post subject: |
|
|
 Grand Master
Joined: 12 Jan 2006 Posts: 1494 Location: Singapore
|
Quote: |
Some option needed with ASBITSTREAM, more options for CAST ? |
not really
try
DECLARE messageChar CHAR
SET messageChar = CAST(messageBlob AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
ensure that InputRoot.Properties.CodedCharSetId contains the right value
good luck..! _________________ Cheers |
|
Back to top |
|
 |
pdrabik |
Posted: Mon Oct 08, 2007 10:30 pm Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
I've discovered that is converting issue.
(previous post updated) _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 09, 2007 1:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
jefflowrey wrote: |
Don't use the XML domain, use XMLNS or XMLNSC. |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pdrabik |
Posted: Tue Oct 09, 2007 6:04 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 09, 2007 6:09 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Well, that's not the specific problem. So, no, it doesn't solve the specific problem.
But it prevents lots and lots of other specific problems.
It's not clear what your input to the ASBITSTREAM is. So it's not clear where the conversion issue is coming from - it's also not clear if the exception is coming from ASBITSTREAM or CAST.
You almost certainly want to include Encoding on the CAST.
Post your current code. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
pdrabik |
Posted: Tue Oct 09, 2007 6:26 am Post subject: |
|
|
Apprentice
Joined: 29 Sep 2006 Posts: 31 Location: poland
|
Input is from InputRoot. Can one past InputRoot for operations like ASBITSTREAM, CAST, MOVE, etc ? Or should it be something like
Set THISROOT = InputRoot, and work on THISROOT ?
And exception is from CAST.
It seems that it is conversion issue, as I mentioned before... cus in exception trace, there is mentioned :
Error while casting:
.converter_Compute.CopyEntireMessage
Text: '46.28'
... then...
Unconvertable character
Text: 'ff' _________________ ---
cc: poltreak@o2.pl |
|
Back to top |
|
 |
|