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 » Repeat fields

Post new topic  Reply to topic
 Repeat fields « View previous topic :: View next topic » 
Author Message
vishal
PostPosted: Wed Mar 31, 2004 10:39 pm    Post subject: Repeat fields Reply with quote

Novice

Joined: 01 Feb 2004
Posts: 13

I have to convert a cobol copy message to XML format.In the cobol copy book message there is a field which is a compound element and can occur no: of times (dynamic) depending upon the another field just above it.

SAMPLE cobol MESSAGE:

05 count Pic x(2)
05 record.
10 A pic X(5)
10 B PIC X(10)

The count field message defines the no: of occurs of the record.

In MRM I defined record (compound element) as

MIN OCCURS 1
MAX OCCURS 10
REPEAT COUNT VALUE OF count(field)

I defined count field as integer.

SAMPLE OUT GOING MESSAGE:
<MYXML>
<record>
<A/>
<B/>
</record>
</MYXML>

The question is how does my ESQL code look like.The incoming count field looks like 01(or) 02.(or)..10.(format).

DECLARE X INTEGER;
SET X= InputBody.count;
declare j=1;

while j<=2
do
assign the elements using the array subscript record [j].A,record [j].B
set j=j+1;

end while;

Does this work.Immediate help is needed .Any advise on this..

Thanks in advance
Back to top
View user's profile Send private message
vishal
PostPosted: Wed Mar 31, 2004 10:41 pm    Post subject: Reply with quote

Novice

Joined: 01 Feb 2004
Posts: 13

DECLARE J INTEGER;
SET J=1;

Coorection in the code...
Back to top
View user's profile Send private message
wooda
PostPosted: Thu Apr 01, 2004 12:18 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

From what you are saying it appear you want the outgoiung message to have the same logical structure as your cobol message.

In this case there is not need to assign each value independantly.

all you have to do is make a copy of the whole message and change the format to XML.

eg.
Code:
-- First copy Headers as appropriate ...

-- Then
SET OutputRoot .MRM = InputRoot.MRM ;
SET OUtputRoot.Properties.MessageFormat = 'XML';


However if you want to copy each element separately then the basic structure of the code you wrote is ok.
(I assume
Code:
while j<=2
should read
Code:
while j<=X
)


why don't you suck it and see
Back to top
View user's profile Send private message
vishal
PostPosted: Thu Apr 01, 2004 5:07 am    Post subject: Reply with quote

Novice

Joined: 01 Feb 2004
Posts: 13

NO..THATS JUST A EXAMPLE...

The outgoing XML message does look different....

May be I am missing the basics here..when we assign the count field as integer..does MRM take it as 03 or 3.

In my case do we need to exclusively specify the message format as XML.I guess we don't need to..When I tried I am getting the errror as XML writting parser.The error is thrown at MQ output node.The code looks fine.

Is it a problem with the count field...
In MRM I did define...

MIN OCCURS 1
MAX OCCURS 2
REPEAT COUNT OF count(field)

When wired the trace node to catch the ${Root}

Every thing looks fine..But I see once(no repeats)In my case it should be three..I guess I am missing some thing...

HELP APPRECIATED.


U R THOUGHTS>>>
Back to top
View user's profile Send private message
waugh
PostPosted: Thu Apr 01, 2004 5:41 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 225

Vishal,

the solution from wooda looks like a good solution to your problem. Ignore the number of repetetions element you are getting in incoming message for a sec. and give it a try by just setting outputroot to XML. see what happens...

if that works then you dont need to do any looping or you dont even care how many repetetions you are getting...
Back to top
View user's profile Send private message
waugh
PostPosted: Thu Apr 01, 2004 6:03 am    Post subject: Reply with quote

Master

Joined: 19 Feb 2004
Posts: 225

all you need is XML out put and a header after you set the outputroot, just add the XML header from your code. That should work...
Back to top
View user's profile Send private message
wooda
PostPosted: Thu Apr 01, 2004 6:27 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

Quote:
May be I am missing the basics here..when we assign the count field as integer..does MRM take it as 03 or 3.


When the CWF message is parsed the value of the integer will be stored in the tree as an integer not a string therefore extraneous zeros and padding characters will be removed. So 03 becomes 3.

The logic you posted for your ESQL looks fine. There are others to do it but the way you chose is ok. however the devil is in the detail. And as you didn't post your actual ESQL then we can't tell what's wrong.

Put two trace nodes (${Root}) in the flow.
One before and one after the compute node.
The first to check the CWF message is parsed correctly.
The second to check your output message is formatted correctly.

My guess is either a bug is your ESQL or a misparsed input message.
Puttting your actual ESQL and output from both trace nodes here will help.
Back to top
View user's profile Send private message
vishal
PostPosted: Thu Apr 01, 2004 10:58 am    Post subject: Reply with quote

Novice

Joined: 01 Feb 2004
Posts: 13

When I assigned the integer value for the count field ..It looks like it is not parsed as expected 003 to 3..But when I checked the option of the extended decimal it is parsed in predictable way.

I wired the trace node from the before the compute node.

My quetsion is how to assign this value(which is in extended decimal type) to the integer..do I need to do cast (or implicitly done)

Because this the field on which loop occurs. I am getting the xception of data conv. error as well as path navigator cursor error.I will post the ESQl code .......ASAP..

thanks,
vinay
Back to top
View user's profile Send private message
wooda
PostPosted: Fri Apr 02, 2004 3:20 am    Post subject: Reply with quote

Master

Joined: 21 Nov 2003
Posts: 265
Location: UK

Hi vishal -

Your count field must be of logical type integer (or otherwise you wouldn't be able to make it a repeat count for another field).

Although the CWF physical type is extended decimal once the field is parsed by the MRM and placed in the message tree the physical type does not matter.

In ESQL it is the logical type which matters.
Your field is an MRM logical type integer so it will be an integer in ESQL.

so no need to cast to an integer. It is already one.

As to why you are getting the data conv errors.

Please post the ESQL and trace info and I can tell you.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Repeat fields
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.