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 » messages

Post new topic  Reply to topic
 messages « View previous topic :: View next topic » 
Author Message
chanduy9
PostPosted: Fri Jan 18, 2002 10:27 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2001
Posts: 177
Location: USA

Hi,
i have a flat file with one header,bunch of records and one trailer.i want to create a message set where it can read header, bunch of records and then trailere. i know how to create a message set for one header, one record and one trailer, but how to create a messageset for one header, multiple records and one trailer...Please help me out.
Thanks in advance.
Chandra.
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Jan 18, 2002 10:33 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Chandra,

Could you please tell us whether the record length for Header, Detail and Trailer record is same or differnt? Are you planning to put whole file as one message or one record as one message for MQSI processing?

Kiran
Back to top
View user's profile Send private message Visit poster's website
chanduy9
PostPosted: Fri Jan 18, 2002 11:21 am    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2001
Posts: 177
Location: USA

Hi,
Thanks for your response,
Header,each record and trailer is 132 byte length. i am planing to put whole file as a single message for processing. The file structure is starting with header then multiple records and trailer. i want to process multiple records in the same message, then want to convert the mrm to xml format.
Flat file looks like,
Header
Record
Record
....
....
Trailer.
each record will have several elements,like name,dept,acc#,ss#,tel# and so on...
Thanks,
Chandra.
Back to top
View user's profile Send private message
kirani
PostPosted: Fri Jan 18, 2002 11:35 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Chandra,

This is only possible if you can manipulate the file to add an integer field in between that will hold 'count' of Detail records. Ultimately, your message structure will look like this,
HEADER0050RECORD1RECORD2.....RECORDNTRAILER

Where,
HEADER is your Header record
0050 - Number of detail records
RECORD1 ... RECORDN - Detail records
TRAILER is your Trailer record

In MRM MessageSet, Define a Message with following elements in it,
HEADER_RECORD (of type HEADER_RECORD_TYPE)
DETAIL_TOT (of type Integer)
DETAIL_RECORD (of type DETAIL_RECORD_TYPE)
TRAILER_RECORD (of type TRAILER_RECORD_TYPE)

For DETAIL_RECORD,
1. In 'Connection' Tab, Set 'Repeat' to Yes.
2. In 'Custom Wire Format' tab, Set 'Repeat Count Type' to 'Value Of' and 'Repeat Count Value Of' to DETAIL_TOT (integer variable)

Let me know if you need more info on this.
Good luck!

Kiran
Back to top
View user's profile Send private message Visit poster's website
chanduy9
PostPosted: Fri Jan 18, 2002 5:13 pm    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2001
Posts: 177
Location: USA

Hi,
I am trying to create the message set from Cobol copybook, whiich is Inbound to MQSI, the file which is input to the message set contain 'n' number of records...i am not sure abt the number of records...the output of the flow should be in XML format....i did this for header, single record and trailer..is ther any generic way to do for multiple records, every record is starting in new line...how to elemenate the new line charecter..
Thanks in advance..
Chandra.
Back to top
View user's profile Send private message
mpuetz
PostPosted: Sat Jan 19, 2002 9:04 am    Post subject: Reply with quote

Centurion

Joined: 05 Jul 2001
Posts: 149
Location: IBM/Central WebSphere Services

Hi Chandra,

since you are getting your message from a COBOL copybook
I assume that all your fields and mesasge parts have fixed
length.

Say
1 x header : length A
n x record : length B (including trailing newline for each record)
1 x trailer : length C
As Kiran mentioned MQSI MRM cannot parse an *arbitrary* number of repeating
elements without deducing the number of repeating units from an integer
variable appearing *prior* to the repeating structure.
This is one of the weak points of the MRM parser (which is not even
resolved in MQSI V2.1 for CWF messages).

You have bayically two options to handle this situation however.

1. The way Kiran mentioned is to modify the input message in such a way
that it includes the repeat count. This would require modifying the
putting application, e.g. by appending the count field in your header
COBOL book. For you this would be the best solution since then you can
proceed as Kiran suggested.
(you get rid of the linefeed, which is usually just one or two characters
by manually appending a dummy string element in your structures, so the
linefeeds get parsed as normal strings, they are just filler bytes
for your purposes)

2. If you can't modify the putting application you may proceed in two steps:

a) Modify the message structure within MQSI to include the repeat count
b) Reparse the message with a slightly modified header structure including
a repeat count field as in point 1 (using Kiran's hints)

Part a) is the only thing which is a bit complicated to do with MQSI's means.

i.) Set your input node message domain to BLOB.
ii.) Define a Message type with ID 'IntConvert' in your MRM domain which contains
just a single integer element with ID 'numRecs'(I suggest choosing a CWF
representation of extented decimal and pick the number of
digits to be able to hold the maximum number of records to
expect in your incoming message).

iii.) In the first compute node after the input node, you calculate
the number of repeating records

Switch on the 'Copy Message Headers' flag
Set the Advanced Flags to 'Message and Destination'

SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageSet = message-set-identifier-containing-the-IntConvert-message;
SET OutputRoot.Properties.MessageType = 'IntConvert';
SET OutputRoot.Properties.MessageFormat = 'CWF';

SET OutputRoot.MRM.numRecs = (LENGTH(InputBody."BLOB" - A - C) / B;
SET OutputDestinationList.copyOfMsg = InputBody."BLOB";

iv.) In the next compute node you do the following

Switch on 'Copy Message Headers' flag
Set the Advanced Flags to 'Message'

SET OutputRoot.Properties.MessageDomain = 'BLOB';

SET OutputRoot."BLOB"."BLOB" = BITSTREAM(InputBody) || InputDestinationList.copyOfMsg;

v.) Modify your imported header structure to include a
new integer field 'numRecs' defined as the first element
of the header structure with the same CWF properties as
in your IntConvert Message Type.

vi.) Put a ResetContentDescriptorNode after your second compute node
and set the message properties to MRM, message-set-containing your-final-message-structure, your-final-message-structure-type, CWF
(don't forget to set the hooks below each field)

Now you can access all elements in following compute nodes.

The method is not as elegant as modifying the input message itself,
since you need to compute the lengths of your structures by hand.
Performance is actually pretty good, since the BLOB parser doesn't
parser anything at all, thus the message is really only parser once
(in the ResetContentDescriptor) and the rendering of the intermediate
message IntConvert triggered by the BITSTREAM is quite fast, too.

I have handled more complex input messages with techniques like this.
However if it requires too many intermediate rendering/parsing steps to get
to your final result, you should definitely consider writing a plugin
node which convert your byte stream to something more suitable for MRM.
This will improve performance a lot and writing plugins isn't all that
difficult.
Cheers,

_________________
Mathias Puetz

IBM/Central WebSphere Services
WebSphere Business Integration Specialist
Back to top
View user's profile Send private message
Segs
PostPosted: Sat Jan 19, 2002 12:11 pm    Post subject: Reply with quote

Voyager

Joined: 04 Oct 2001
Posts: 78
Location: Zurich Financial Services

I've done a fair bit of work with this, I think your best bet would be to try to make use of the 'occurs depending' statement available within COBOL. Try to create a COBOL copybook to mirror the record, import to a message set.

Any problems please shout.

Segs...
Back to top
View user's profile Send private message Send e-mail
kirani
PostPosted: Sat Jan 19, 2002 1:26 pm    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Chandra,

If you decide to put whole file as one message, you will have to consider other limitations. MQSeries has a limitation of 100MB message size. You will have problems if your file size exceeds 100MB.

We have done something similar for our client. Since MQSI does not support reading data from a file and put it on a queue, we have developed an Adapter which will package 100 records and put it as one message on a queue. While packaging records, adapter will also put a count (number of records packaged) in front of those packaged records. This makes it easier for MRM to parse the message. Adapter puts these messages as a part of group.

Good luck!

Kiran
Back to top
View user's profile Send private message Visit poster's website
chanduy9
PostPosted: Tue Jan 22, 2002 1:05 pm    Post subject: Reply with quote

Disciple

Joined: 28 Nov 2001
Posts: 177
Location: USA

Hi,
Thanks for solutions...how to create a cobol copybook using occurs..does it takes dynamic values.Segs please explain me how to use this and what are the changes i have to do.
Thanks,
Chandra.
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 » messages
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.