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 » Parsing Multiple Cobol input files into XML

Post new topic  Reply to topic
 Parsing Multiple Cobol input files into XML « View previous topic :: View next topic » 
Author Message
6thelement
PostPosted: Mon Nov 24, 2008 8:59 am    Post subject: Parsing Multiple Cobol input files into XML Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

Hi,

Here is my problem statement.
The input message is nested Cobol Copybook. The output message is single XML.
The cobol copybook contains one parent element and (0-99999) no.s of child elements. Each of these parent and multiple child elements refer to different copybooks for validation.
What I need to do is get the complete input message as Cobol Copy book from input, validate the parent cobol copybook, map to the output xml file, then check for the child element it contains by looping through the child elements. Once we find the existence of the child element, we need to validate the message and then map the fields to XML output file.

These are the steps I have thought of to follow.
1. Need to validate the parent cobolcopy book at the MQ input node.
2. Then in a compute node ESQL will map the parent cobol copybook fields to output XML file
3. Then in the compute node ESQL itself, the child element looping will be done
4. Once it find the child element record, it has to validate and map the input child cobolcopybook fields into the same output XML file mentioned in step-2.

I need help in implementing the Step-4 for this problem. If you people think of a better way to implement the complete solution, please let me know.
Also let me know if I am still not clear about the problem statement.
Back to top
View user's profile Send private message
kimbert
PostPosted: Mon Nov 24, 2008 2:16 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

General approach sounds good.

You have not explained how the MRM parser will identify each child record. That is a really important design point.

Your message tree ( both InputRoot and OutputRoot ) may get large. You might want to read this: http://www.ibm.com/developerworks/websphere/library/techarticles/0505_storey/0505_storey.html
Back to top
View user's profile Send private message
6thelement
PostPosted: Tue Nov 25, 2008 6:09 am    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

Thanks for sharing the article. For the question how the MRM will identify the child elements, this is how it is.
Each of these records are of fixed length including the parent record(100 bytes). So here is how it looks like when the input message comes.

<10abc....n20abc...n30abc...n40abc....n>

Now the message definition file(copybook) is designed with 10abcdef parent element and rest all as child elements.
<10
a
b
c
xy
a
b
c>
Once the message is parsed through the above parent message definition file, the child record are searched for the record identifiers which always exist at the first place(xy). Once the particular child record is identified(Say 20abc....n), that message needs to be parsed against its message definition file and the values are mapped to the same XML tree.
I am not very sure whether I was able to put the problem statement clearly. How do we parse this child element against the child1.mxsd or child2.mxsd dynamically?

Thanks............
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Nov 25, 2008 6:21 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

The MRM parser can do all of this automatically. You just need to set up your message set correctly. You will need to write some ESQL to loop over the child messages until they are all parsed, but you should *not* need to identify the child messages using ESQL.

You need Message Alias/Message Identity. Please read this and let me know if you have any questions: http://publib.boulder.ibm.com/infocenter/wmbhelp/v6r1m0/topic/com.ibm.etools.mft.doc/ad00761_.htm

Suggestion: The easy way to do this is to develop the message set first, then the ESQL.
1. Set Parse Timing to 'Immediate' on the input node, and adjust your message set until the entire message is parsed successfully. Remember to use User Trace for diagnosing parser errors, not only the debugger.
2. Set Parse Timing to 'On Demand'. Now develop and debug your ESQL which loops over the child records.
Back to top
View user's profile Send private message
6thelement
PostPosted: Tue Nov 25, 2008 7:07 am    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

The message sets are already defined. This is a cobol copy book input.
So as per my previous example, I have like one message set which contains four (.mxsd) files corresponding to one parent and three children.

1. The input message is parsed at the MQinput node with parent.mxsd. Within the parent.mxsd, The repeatable child elements are defined as one fixed length chunk of 100 byes with repeat structure
<100 bytes of Parent>
<100 bytes of child1>
<100 bytes of child2>
<100 bytes of child3>
Although the total length of each child is same, the structure is different for each except the initial record identifier. And each of these child elements has got separate mxsd files.
So my understanding is we identify the presence of child element through the initial record identifier through ESQL only. I am not sure whether Message Alias/Identity is something that we need here.
Once we identify the child, again it has to be parsed against the child.mxsd only. Or else how are we going to identify the fields in the child.mxsd to map into output file.
Do you think I am clear? Please let me know if you need some other information to identify the problem.
As per your suggestion, the parent message (containing the child elements as repeating structure) is being parsed at the input node only.
I am sorry if its all confusing...
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Nov 25, 2008 8:36 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
The message sets are already defined
Yes, I know. But you need to edit the imported message definitions. The importer does not know that the record identifier is a record identifer.
Quote:
So my understanding is we identify the presence of child element through the initial record identifier through ESQL only
No. You do not need ESQL to identify the child elements. The MRM parser can use the record identifier.
Quote:
I am not sure whether Message Alias/Identity is something that we need here.
You definitely need Message Alias/Message Identity.

Your message definition should look something like this (not tested):
Code:
Message
    ParentRecordIdentifier InterpretValueAs='MessageIdentity'
    Group Composition=Message
        ParentMessage Message Alias='10'
    Group maxOccurs=-1
        ChildRecordIdentifier  InterpretValueAs='MessageIdentity'
        Group composition='Message'
            ChildMessage1  Message Alias='20'
            ChildMessage2  Message Alias='30'
            ChildMessage3  Message Alias='40'
            ChildMessage4  Message Alias='50'

Does that make sense now?
Back to top
View user's profile Send private message
6thelement
PostPosted: Tue Nov 25, 2008 1:10 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

Probably I am thinking in the wrong direction. .
Do you think I can paste the Sample Message Definition Files and Code for your reference. Would it be possible to paste the image files on this post?

[/img][/url]
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Nov 25, 2008 1:59 pm    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Do you think I can paste the Sample Message Definition Files and Code for your reference. Would it be possible to paste the image files on this post?
Both are possible, but I do not think that would be useful at this stage.

Do you understand what I am suggesting, and how it would work? Is there anything which I need to explain in more detail?
Back to top
View user's profile Send private message
6thelement
PostPosted: Tue Nov 25, 2008 2:44 pm    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

I thought we are not supposed to modify the message definition file when its imported from Cobol Copy book. And the modifications has to be done on the cobol copy book and reimport it. is it correct?
Few quick questions for the solution given.
* Say I have 5 cobol copybook files as per the sample message definition file given by you. Am I going to create the message definitions separately with a relation of parent and child as explained by me earlier or will it be different?
* Now for your example, let me rephrase the problem.
--> 1. here is how the one input cobol copybook message that comes as
input look like.
10abcd......20mnop........30wxyz.........40qrst..........50ijkl........
--> 2. I modified the first cobol copy book(10abcd......) to contain the
(20abcd..... to 50abcd....) elements. Thats how I call it as parent
and children.
--> 3. So First Cobol copy book(parent.mxsd) will contain something like:
10abcd.....
nnxxxx..... (nn = record identifer for 20/30/40/50
xx = Contained data which is different for 20/30/40/50)
--> 4. Then the (20abcd..... to 50abcd....) cobol copy books need not be
changed. Its the same as imported to the message definition file.
--> 5. My idea was to once I parse the message using MQinput node
through the (parent.mxsd), I can access the elements of parent and
assign it to output xml in the Comput node ESQL.
--> 6. Next I can loop through the nnxxxx..... from parent.mxsd, and find
out the 20/30/40/50 identifiers.
--> 7.If say I found out 20 identifier, I need to parse it again using the
20abcd....mxsd file to access the fields of this child. Once I access the
fields, I would be able to map it into the same XML file on step.5
And this is the step where I am not able to think how to do it?
--> Now the question is whether I would be able to do it in a simple way
without modifying the message definition as imported from cobol
copybook?
No offence..May be I was not able to put the problem statement
clearly and am not mentally convinced that the above approach wont
work.

Please suggest the best way. If the above approach will not work and I really need Message Alias/Identity for the solution, I can do some studies and designing the message definition file accordingly.

Thank you so much for your patience and time.
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Nov 26, 2008 2:12 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I thought we are not supposed to modify the message definition file when its imported from Cobol Copy book. And the modifications has to be done on the cobol copy book and reimport it. is it correct?
The importer is just a time-saver. Feel free to modify your message sets as much as you like to get the job done.

Quote:
6. Next I can loop through the nnxxxx..... from parent.mxsd, and find
out the 20/30/40/50 identifiers.
--> 7.If say I found out 20 identifier, I need to parse it again using the
20abcd....mxsd file to access the fields of this child.
So you are intending to
- Read the next record identifier and map it to a variable 'messageName'
- Use
Code:
CREATE...PARSE DOMAIN MRM PARSE( myBitstream SET myMessageSet Type myMessageType Format 'CWF1')
If my guess is correct, where will you get myBitstream from?

Or maybe when you merged the copybooks, you used REDEFINES, and you now have a message set containing a choice of 10/20/30/40/50. In which case, your ESQL will resolve the choice automatically when you reference the child element.
Back to top
View user's profile Send private message
6thelement
PostPosted: Wed Nov 26, 2008 6:13 am    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

Yes. I am not sure how I will get the Bitstream data. The message is a parsed message(parsed by parent.mxsd) in MRM domain. Now do you think its possible to parse the child message to BLOB data and again parse it with a child.mxsd using the Code suggested by you. As the data is already in the MRM message tree, it wont be a bitstream anymore.

Do you think the sample message parent.mxsd and child.mxsd will help more?

I havnt used redefines in the cobol copybook. I guess I can only redefine the record identifier as a field, but the data will be different for different child elements(20/30/40/50).
Please share your thoughts...
Back to top
View user's profile Send private message
kimbert
PostPosted: Wed Nov 26, 2008 6:33 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

I think I have shared just all of my thoughts on this. Here's what you need to do:

1. Modify the COBOL copybooks, making the 20/30/40/50 into members of a REDEFINES clause. Or else modify your message definitions to create the equivalent choice in the mxsd.

2. You must choose how to resolve the child elements...
2A: Resolve the child elements using ESQL
- The CWF parser will not parse the choice until your ESQL attempts to reference it. So if you write your ESQL to detect the record identifier and access the correct branch of the choice, the 20/30/40/50 child element will get parsed correctly.

2B: Resolve the child elements using Message Alias/Message Identity

I would choose 2B is because it puts all the information about the physical format of the message into the message set. Either way will work, though.
Back to top
View user's profile Send private message
6thelement
PostPosted: Wed Nov 26, 2008 6:38 am    Post subject: Reply with quote

Apprentice

Joined: 07 Nov 2008
Posts: 30

Hey Thank you so much for this. I will let you know which method I adopted and how it worked once I am done. Will keep the forum posted.
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 » Parsing Multiple Cobol input files into XML
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.