ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Casting the next record with NEXTSIBLING into a BLOB var

Post new topic  Reply to topic
 Casting the next record with NEXTSIBLING into a BLOB var « View previous topic :: View next topic » 
Author Message
yonny
PostPosted: Thu Nov 02, 2006 2:58 pm    Post subject: Casting the next record with NEXTSIBLING into a BLOB var Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Thu Nov 02, 2006 3:18 pm    Post subject: Re: Casting the next record with NEXTSIBLING into a BLOB var Reply with quote

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
View user's profile Send private message
yonny
PostPosted: Fri Nov 03, 2006 8:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Fri Nov 03, 2006 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
yonny
PostPosted: Fri Nov 03, 2006 10:11 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Fri Nov 03, 2006 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message
yonny
PostPosted: Fri Nov 03, 2006 10:28 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
jefflowrey
PostPosted: Fri Nov 03, 2006 10:29 am    Post subject: Reply with quote

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
View user's profile Send private message
jefflowrey
PostPosted: Fri Nov 03, 2006 10:33 am    Post subject: Reply with quote

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
View user's profile Send private message
yonny
PostPosted: Fri Nov 03, 2006 10:42 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
yonny
PostPosted: Fri Nov 03, 2006 10:47 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail AIM Address
fjb_saper
PostPosted: Fri Nov 03, 2006 3:16 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
yonny
PostPosted: Wed Nov 08, 2006 7:48 am    Post subject: Reply with quote

Apprentice

Joined: 08 Jul 2001
Posts: 49
Location: Santo Domingo

Problem solved using fjb_saper aproach. Thank you
------------------
Back to top
View user's profile Send private message Send e-mail AIM Address
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Casting the next record with NEXTSIBLING into a BLOB var
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.