Author |
Message
|
yonny |
Posted: Thu Nov 02, 2006 2:58 pm Post subject: Casting the next record with NEXTSIBLING into a BLOB var |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
Hello all, could you please help me to figure out what am i doing wrong here. This is part of my esql code for a compute node:
Code: |
DECLARE RecRef REFERENCE TO InputRoot.MRM.RepeatingRecord[1];
...
SET temp_blob = CAST('my_header' AS BLOB CCSID 819);
WHILE LASTMOVE(RecRef) = TRUE DO
SET temp_blob = temp_blob || ASBITSTREAM(RecRef
ENCODING InputRoot.MQMD.Encoding
CCSID InputRoot.MQMD.CodedCharSetId
OPTIONS RootBitStream
SET 'FDK000000000'
TYPE 'MyMessage'
FORMAT 'CWF1');
MOVE RecRef NEXTSIBLING;
END WHILE; |
And my (input) MessageSet (MyMessage, FDK000000000) looks like:
Code: |
MyMessage ComplexType1
RepeatingRecord RepatingRecordType
FieldA xsd:string
FieldB xsd:string
FieldC xsd:string |
So, the problem is that the ASBITSTREAM function is always returning the first record, although there are more than 1 "repeating records" in my message. When I debug my flow I can see the RecRef variable moving to the next record with every loop of the while statement. So, the RecRef pointer changes to the next record but, the ASBITSTREAM function always returns a BLOB value of the first record.
I am trying to concatenate all the records in a single BLOB variable. Any ideas? thanks in advance,
Yonny |
|
Back to top |
|
 |
jefflowrey |
Posted: Thu Nov 02, 2006 3:18 pm Post subject: Re: Casting the next record with NEXTSIBLING into a BLOB var |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
yonny wrote: |
OPTIONS RootBitStream |
_________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
yonny |
Posted: Fri Nov 03, 2006 8:16 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
Thank you for your answer jeff, I tried two different forms to call the function:
Without the OPTIONS parameter:
Code: |
SET temp_blob = temp_blob || ASBITSTREAM(RecRef
ENCODING InputRoot.MQMD.Encoding
CCSID InputRoot.MQMD.CodedCharSetId
SET 'FDK000000000'
TYPE 'MyMessage'
FORMAT 'CWF1'); |
The result is the same as when using RootBitStream.
When using FolderBitStream the broker returns the exception: FolderBitStream is unsupported for the MRM domain
Any other ideas? |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 03, 2006 9:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So, why exactly are you trying to get the bitstream of a Character string?
I don't really understand enough of what you're really trying to do. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
yonny |
Posted: Fri Nov 03, 2006 10:11 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
I am using a CWF message set like this:
Code: |
MyMessage ComplexType1
RepeatingRecord RepatingRecordType
FieldA xsd:string Length=10
FieldB xsd:string Length=5
FieldC xsd:string Length=10 |
The padding (fill) character is the space " ". So let's say that I had processed a test message and the message tree looks like this:
RepeatingRecord[1]
FieldA -> 'Hello'
FieldB -> 'World'
FieldC -> 'thank'
RepeatingRecord[2]
FieldA -> 'god'
FieldB -> 'is'
FieldC -> 'friday'
I need my output message in the local queue to look like:
Code: |
'Hello Worldthank god is friday '
|---10----|-5--|---10----||---10----|-5--|---10----| |
This is the final step of a looong message flow i am working on, your help will be truly appreciated. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 03, 2006 10:18 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So you don't need to ASBITSTREAM those fields, right? They're already strings, right?
So just || them, right? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
yonny |
Posted: Fri Nov 03, 2006 10:28 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
Yes, they are already strings, what i need is to fill every field with the padding character (SPACE).
I tried at first just to || the fields, but the function did not return a string with the fields filled with spaces.
That's why I started to try with the BITSTREAM and ASBITSTREAM function. And they do return the records with the full length filled with spaces, but then, the original problem of this topic appeared. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 03, 2006 10:29 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Oh.
I think the OVERLAY function would suit? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Nov 03, 2006 10:33 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Or if you don't want to encode field lengths in your flow, then create another message definition in the same message definition file that only includes the repeating fields and then do an ASBITSTREAM on that. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
yonny |
Posted: Fri Nov 03, 2006 10:42 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
The problem with the OVERLAY function is that there are several (different) message sets used to parse the input message, so I do not know the exact lenght of every field to filled it with spaces using the OVERLAY funcion.
Is it posible to check for an element property value within a compute node? how? |
|
Back to top |
|
 |
yonny |
Posted: Fri Nov 03, 2006 10:47 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
Quote: |
then create another message definition in the same message definition file that only includes the repeating fields and then do an ASBITSTREAM on that. |
Could you please go more deep into that?
My message set only includes one "Complex" element, the repeating record. |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Nov 03, 2006 3:16 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
What you need is a complex message.
Example you have a message "MyMessage" which has 3 elements:
"myheader1" type "MyHeader1"
"myheader2" type "MyHeader2"
"mybody" type "MyBody".
Think you built the message the following way:
imported 3 cbl copy books and created a type and msg from each.
Created your own message definition patching it together.
Now if you want to serialize myheader2 you go to the reference, say as RootBitstream and specify:
messageSet = mymsgset
messageType=msg_MyHeader2
messageFormat='CWF1'.
That should do it.
Enjoy
 _________________ MQ & Broker admin |
|
Back to top |
|
 |
yonny |
Posted: Wed Nov 08, 2006 7:48 am Post subject: |
|
|
 Apprentice
Joined: 08 Jul 2001 Posts: 49 Location: Santo Domingo
|
Problem solved using fjb_saper aproach. Thank you
------------------ |
|
Back to top |
|
 |
|