Author |
Message
|
GuptaVineet |
Posted: Tue Jul 19, 2011 12:04 pm Post subject: Need Help on Message Set |
|
|
Newbie
Joined: 19 Jul 2011 Posts: 7
|
Hi
i need help for creating Message Set for following pattern of the data
data1data2
***Start repeat 1 ***
obj1data3data4
obj2data3data4
***End repeat 1 ***
***Start repeat 2 ***
obj1data5
obj2data5
***End repeat 2***
I am using Message Broker 7.0. I am able to specify lengths of MRM-TDS structure but not able to handle ***Start repeat 1*** and ***Start repeat 2***
Can you please help me in this
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Tue Jul 19, 2011 12:14 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
What does the message set you've currently got look like? How does it react to the input data? What solutions have you already tried that haven't worked (so we don't waste time suggesting those)?
Better information, better advice. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
GuptaVineet |
Posted: Tue Jul 19, 2011 12:32 pm Post subject: |
|
|
Newbie
Joined: 19 Jul 2011 Posts: 7
|
I have tried adding TDS physical format to the message set and define length of each of the data element and then where i specified repeating structure i tried to define it by tag ***START Repeat 1*** and repeating element identifier as <CR><LF> but at FileInput node, it throws following exception CHARACTER:ImbRecoverableException caught from worker->initializeParse/setFIHandler. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 20, 2011 5:33 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Either describe your data format and message set in detail, or else take a debug-level user trace and go through the TDS output line by line. |
|
Back to top |
|
 |
GuptaVineet |
Posted: Wed Jul 20, 2011 12:37 pm Post subject: |
|
|
Newbie
Joined: 19 Jul 2011 Posts: 7
|
Hi,
This is real data
Field Posn. Length
Plant code 1 4
Date of Extract 5 8
Time of Extract 13 8
Line 2
Static Text: **START PO HEADER**
Line 3 -> Line 2+nn (nn is number of PO header)
Field Posn. Length Formatting
Order Number 1 12 Left Aligned
Material Number 13 18 Left Aligned
Batch Number 31 10 Left Aligned
Description 41 40 Left Aligned
Legacy Material Number 81 18 Left Aligned
Quantity 99 13 Right Aligned
Unit of Measure 112 3 Left Aligned
Line nn+3
Static Text: **END PO HEADER**
Line nn+4
Static Text: **START PO LINE**
Line nn+5 -> nn+4+mm (mm - number of PO Lines)
Field Posn. Length Formatting
Order Number 1 12 Left Aligned
Allocated Batch 13 10 Left Aligned
Line nn+5+mm
Static Text: **END PO LINE**
Example Message:
US0620110715093822
**START PO HEADER**
Order01 H1234567890 A12345 Test Material Description for order 1 Legacy1 1234.56LTR
Order02 H2342342342 F2342342 This is something else. 1000KG
Order03 F2342 Order03 Material F2343 Description Old Mat Number 1000KG
**END PO HEADER**
**START PO LINE**
Order01Batch1
Order01Batch2
Order03Batch3
**END PO LINE**
I hope now you can understand my problem.
Actually, Now, I try to solve this problem using CWF now and it seems i reached very near to the solution, The only thing, when i specified the repeating instance, I cannot specify repeating reference.
How to calculate repeat reference between two tags
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 21, 2011 11:09 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Edited to make it readable:
This is real data
Code: |
Line 1
Field Posn. Length
Plant code 1 4
Date of Extract 5 8
Time of Extract 13 8
Line 2
Static Text: **START PO HEADER**
Line 3 -> Line 2+nn (nn is number of PO header)
Field Posn. Length Formatting
Order Number 1 12 Left Aligned
Material Number 13 18 Left Aligned
Batch Number 31 10 Left Aligned
Description 41 40 Left Aligned
Legacy Material Number 81 18 Left Aligned
Quantity 99 13 Right Aligned
Unit of Measure 112 3 Left Aligned
Line nn+3
Static Text: **END PO HEADER**
Line nn+4
Static Text: **START PO LINE**
Line nn+5 -> nn+4+mm (mm - number of PO Lines)
Field Posn. Length Formatting
Order Number 1 12 Left Aligned
Allocated Batch 13 10 Left Aligned
Line nn+5+mm
Static Text: **END PO LINE**
|
Example Message:
Code: |
US0620110715093822
**START PO HEADER**
Order01 H1234567890 A12345 Test Material Description for order 1 Legacy1 1234.56LTR
Order02 H2342342342 F2342342 This is something else. 1000KG
Order03 F2342 Order03 Material F2343 Description Old Mat Number 1000KG
**END PO HEADER**
**START PO LINE**
Order01Batch1
Order01Batch2
Order03Batch3
**END PO LINE** |
Next time you post data or XML, please use [c o d e] tags.
Thanks |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 21, 2011 12:36 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You need to use TDS, not CWF. CWF is for fixed-format data like COBOL or C records. This format is not easy to model correctly - if you need some hints just ask. |
|
Back to top |
|
 |
GuptaVineet |
Posted: Mon Jul 25, 2011 10:03 am Post subject: |
|
|
Newbie
Joined: 19 Jul 2011 Posts: 7
|
@ Jedi: thanks a lot for converting my post into readable format.
@All: Also, I tried TDS message set, But i am getting error: "Missing a group indicator for complex type or group
Code: |
<?xml version="1.0" encoding="UTF-8"?><xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="PO" type="PurchaseOrder">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<MRMessage messageDefinition="/0/PO;XSDElementDeclaration$MRObject"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:complexType name="PurchaseOrder">
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="PlantCode" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep length="4" lengthUnits="Bytes" messageSetDefaultRep="Text5" precision="-1"/>
<cwfInclRep messageSetDefaultRep="CWF1">
<cwfSimpleRep encodingNull="NullLogicalValue" mrLengthEncoding="fixedLength" paddingCharacter="NUL" stringJustification="leftJustify" typeName="MRCWFStringRep" width="4"/>
</cwfInclRep>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExtractDate" type="xsd:date">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep format="yyyyMMdd" length="8" lengthUnits="Bytes" messageSetDefaultRep="Text5" paddingCharacter="SPACE" precision="-1"/>
<cwfInclRep messageSetDefaultRep="CWF1">
<cwfSimpleRep format="yyyyMMdd" typeName="MRCWFDateTimeRep">
<MRCWFStringRep_MRCWFSimpleTD encodingNull="NullPadFill" mrLengthEncoding="fixedLength" paddingCharacter="NUL" stringJustification="leftJustify" width="8"/>
</cwfSimpleRep>
</cwfInclRep>
<xmlInclRep format="yyyyMMdd" messageSetDefaultRep="XML1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ExtractTime" type="xsd:time">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep format="HHmmss" length="6" lengthUnits="Bytes" messageSetDefaultRep="Text5" paddingCharacter="SPACE" precision="-1"/>
<cwfInclRep messageSetDefaultRep="CWF1">
<cwfSimpleRep format="HHmmss" typeName="MRCWFDateTimeRep">
<MRCWFStringRep_MRCWFSimpleTD encodingNull="NullPadFill" mrLengthEncoding="fixedLength" paddingCharacter="NUL" stringJustification="leftJustify" width="6"/>
</cwfSimpleRep>
</cwfInclRep>
<xmlInclRep format="HHmmss" messageSetDefaultRep="XML1"/>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:sequence>
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsStructRep dataElementSeparation="FixedLength" delimiter="<CR><LF>" groupIndicator="**START PO HEADER**" groupTerminator="**END PO HEADER**" messageSetDefaultRep="Text5"/>
<cwfInclRep messageSetDefaultRep="CWF1" skipCountTrailing="0">
<cwfSimpleRep/>
</cwfInclRep>
<tdsInclRep dataPattern="" messageSetDefaultRep="Text5"/>
</xsd:appinfo>
</xsd:annotation>
<xsd:element maxOccurs="unbounded" name="orderHeader">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<cwfInclRep messageSetDefaultRep="CWF1" skipCountLeading="2" skipCountTrailing="0">
<cwfSimpleRep/>
</cwfInclRep>
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="orderNumber" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="WMQI_APPINFO">
<tdsElemRep length="12" lengthUnits="Bytes" messageSetDefaultRep="Text5" precision="-1"/>
<cwfInclRep messageSetDefaultRep="CWF1">
<cwfSimpleRep encodingNull="NullLogicalValue" mrLengthEncoding="fixedLength" paddingCharacter="NUL" stringJustification="leftJustify" typeName="MRCWFStringRep" width="12"/>
</cwfInclRep>
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
|
Message looks like
Code: |
US0620110715093822
**START PO HEADER**
Order01 H1234567890 A12345 Test Material Description for order 1 Legacy1 1234.56LTR
Order02 H2342342342 F2342342 This is something else. 1000KG
Order03 F2342 Order03 Material F2343 Description Old Mat Number 1000KG
**END PO HEADER**
|
Can you tell me what exactly i am doing wrong... |
|
Back to top |
|
 |
lancelotlinc |
Posted: Mon Jul 25, 2011 10:35 am Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
kimbert |
Posted: Mon Jul 25, 2011 12:23 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
First, you need to decide what the structure of your message tree will look like. I think it should look like this:
Code: |
FirstLine
plantCode
extractDate
extractTime
POHeader
order
orderNumber
materialNumber
BatchAllocations
batch
orderNumber
allocatedBatch |
Then you need to create a message definition for that logical structure. The key points are:
Code: |
- You *must* use TDS. CWF will not work. Trust me on this.
- FirstLine has a complex type with
dataElementSeparation='Fixed Length'
- POHeader has a complex type with
dataElementSeparation='All elements delimited'
delimiter='<CR><LF>'
Group Indicator='**START PO HEADER** '
Group Terminator='**END PO HEADER** '
- within POHeader, the 'order' element has a complex type with
dataElementSeparation='All elements delimited'
delimiter='<CR><LF>'
- the 'order' element has minOccurs=1, maxOccurs='unbounded'
|
...and the BatchAllocations structure follows the same pattern. I'll let you work out the details.
Two final points:
a) if it doesn't work ( and it probably will not work first time ) then disconnect the debugger and take a debug-level user trace. Then read the TDS entries in the trace to work out what went wrong.
b) if you post another question, first do a), then quote all error messages in full, and quote any relevant entries from the user trace.
You may have noticed that there is no 'repeat reference' in my proposed message model. That's because TDS can work out how many repeats there are by looking for the Group Terminator. |
|
Back to top |
|
 |
GuptaVineet |
Posted: Thu Jul 28, 2011 7:20 am Post subject: |
|
|
Newbie
Joined: 19 Jul 2011 Posts: 7
|
@ Kimbert, Thanks a lot. It works with TDS but after Changing it to Fixed length and then using <CR><LF> at the end of Group Start indicator |
|
Back to top |
|
 |
|