Author |
Message
|
narki |
Posted: Sun Jun 25, 2006 6:13 pm Post subject: Sequence of record is not fixed |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
I have a design issue,
I need to transform CobolCopy book to an XML. The cobol copy book whivh I will be getting will be a set of records
like R1......R2......T1......P1........... Each record is of 3500 bytes. First two character will represent record type.
These record can occurs in any order and lenght of the message will vary. Ths cobol copybook need to be tansaformed into XML filed by field basis.
Similarly I need to transform XML to cobol copy book.
One solution come to my mind is as follows
1. creat a message for each record in message set.
2. Create a function for each record type
3. In the function pass this record and Outputroot . Use the CREATE statement with the DOMAIN and PARSE clauses to record.
4. Finally use set statement for set outgoung XML messages.
I have to write alsmost 35 function for this as I will be geting n35 diffrent kind of records. Similrly I have to write 35 diffent function for converting XML to copybook
I would like to know is there any better solution to this us present. Please share you knowledge for this problem. |
|
Back to top |
|
 |
elvis_gn |
Posted: Sun Jun 25, 2006 8:14 pm Post subject: Re: Sequence of record is not fixed |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi narki,
narki wrote: |
These record can occurs in any order and lenght of the message will vary. Ths cobol copybook need to be tansaformed into XML filed by field basis.
Similarly I need to transform XML to cobol copy book.
One solution come to my mind is as follows
1. creat a message for each record in message set.
2. Create a function for each record type
3. In the function pass this record and Outputroot . Use the CREATE statement with the DOMAIN and PARSE clauses to record.
4. Finally use set statement for set outgoung XML messages.
I have to write alsmost 35 function for this as I will be geting n35 diffrent kind of records. Similrly I have to write 35 diffent function for converting XML to copybook |
If the order of your records is random, how are u going to create a message set ?
How about this....not sure it will work with copybooks.
Create a message with one complex tag,say Root. This will have -1 max occurances....define all the other records as complex types within this Root, with min occurance of 0 and max 1...
I think it should fetch all the segments and create your message without any ESQL.
Regards. |
|
Back to top |
|
 |
shalabh1976 |
Posted: Sun Jun 25, 2006 11:05 pm Post subject: |
|
|
 Partisan
Joined: 18 Jul 2002 Posts: 381 Location: Gurgaon, India
|
How about using Type Composition as Unordered Set ? _________________ Shalabh
IBM Cert. WMB V6.0
IBM Cert. MQ V5.3 App. Prog.
IBM Cert. DB2 9 DB Associate |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 27, 2006 12:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi Narki,
If your messages only contain character data, you could use the MRM TDS format ( your message is a repeating sequence of tagged records, and MRM TDS is good at handling tagged data ).
However, I'm assuming that with 3500 bytes in each record, there are probably some CWF-specific types ( e.g. packed decimal, integer ). If so, your approach is on the right lines, but I reckon you could make it a lot simpler. Instead of creating one function per record type, why not use a single function which takes the message name as a parameter? Otherwise you will be creating and maintaining 35 almost-identical functions. If you name each message using its two-character identifier you can extract the message name from the bitstream automatically.
Similar comments apply to the XML -> copybook scenario. |
|
Back to top |
|
 |
narki |
Posted: Tue Jun 27, 2006 5:45 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
Hi kimbert,
Yes I am also little bit uncomfortable with 35 functions, but I need to map CWF filed to XMl field, which are diffrent name. Like in cwf it is FOO_ONE and equivalent XML name is FooOne. I am looking some solution at message set and message level.
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 28, 2006 2:10 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
The MRM XML format allows you to use an XML name which is different from the name in the tree (see 'XML Name' property on elements and attributes). You could use this facility to avoid the mapping of names in ESQL. Then your 35 functions could be collapsed into one. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Jun 28, 2006 2:28 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Also, the v6 Mapping tool can handle (i.e., automatically map for you) some kinds of name differences - like it might be able to tell that FOO_ONE should go to FooOne.
But you'd need to build 35 different maps - I think. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
narki |
Posted: Wed Jun 28, 2006 7:29 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
Kimbert,
There are some fields which are not required in XML like FILLERS. Also Cobol Copy book a lot and huge. I am just worrird if I use 35 functions how will be performance. I am just looking for the best approach for this.
Thanks
Naren |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jun 29, 2006 12:55 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Having 35 functions instead of 1 should not affect performance ( I would be more concerned about maintainability). I expect it would perform better if you could model the entire message using a single message definition - but that's not possible. |
|
Back to top |
|
 |
narki |
Posted: Wed Jul 12, 2006 3:09 pm Post subject: |
|
|
Acolyte
Joined: 19 Dec 2005 Posts: 67
|
Can I use XMLTransformation node for this kind of scenario. Can I have XSLT whchi will transform Cobol Copybook to an XML. What about validation of those field. Please provide your input ASAP. |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 13, 2006 12:32 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Can I have XSLT which will transform Cobol Copybook to an XML |
No. XSLT converts XML -> XML or XML->string. |
|
Back to top |
|
 |
|