|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Fixed length with group indicator |
« View previous topic :: View next topic » |
Author |
Message
|
matuwe |
Posted: Tue Jun 17, 2008 7:49 am Post subject: Fixed length with group indicator |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
please help. I am trying to create a msg set that will read data
0020080601
0120080601145
03heloohelpme1
03heloohelpme2
03heloohelpme3
09close1
0120080602145
03heloohelpme11
03heloohelpme21
03heloohelpme31
09close2
99closefile
00shows the beginning of file header
01shows the beginning of recordhearder
03shows the beginning of recorddata
09shows record footer
99shows file footer
It never reads the record footer, everything is read as record data. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jun 17, 2008 12:30 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
I suggest you try this:
Code: |
element name="File"
complexType DES="Tagged Fixed Length", Tag Length="2", composition="Sequence"
element name="fileHeader", tag="00"
element name="recordHeader", tag="01"
element name="recordData", tag="03"
element name="recordFooter", tag="09"
element name="fileFooter", tag="99"
|
If you want the recordHeader, recordData, recordFooter to repeat, then put them into a group with the same TDS settings as the complex type, and set maxOccurs to -1 on the group. |
|
Back to top |
|
 |
matuwe |
Posted: Wed Jun 18, 2008 1:07 am Post subject: |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
Hi thakx for y'r response. The only problem is my data is not really tagged. The only tag I have is the first two chars. Now my msg set wants me to set the tag fpr all the fields inside recordHeader and recordFooter. Sorry am I missing something. Or maybe I am trying to do something that is not possible.
please help. I am trying to create a msg set that will read data
0020080601
0120080601145
03heloohelpme1
03heloohelpme2
03heloohelpme3
09close1
0120080602145
03heloohelpme11
03heloohelpme21
03heloohelpme31
09close2
99closefile
I also want to read the recordheader as fixed length with complextype
2 for record_Identi 4 as date and 5 as time. I have attached my xsd.... thanking you in advance
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="FileHeader">
<xsd:sequence>
<xsd:element name="RecordCode" type="xsd:string">
</xsd:element>
<xsd:element name="DateTime" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ChannellHeader">
<xsd:sequence>
<xsd:element name="RecordCode" type="xsd:string">
</xsd:element>
<xsd:element name="ChannelCode" type="xsd:string">
</xsd:element>
<xsd:element name="RegionalCode" type="xsd:string">
</xsd:element>
<xsd:element name="TXDate" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SpotRecord">
<xsd:sequence>
<xsd:element name="RecordCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="4" name="ChannelCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="8" name="TXDate" type="xsd:string">
</xsd:element>
<xsd:element name="SpotTime" type="xsd:string">
</xsd:element>
<xsd:element fixed="3" name="SpotLength" type="xsd:string">
</xsd:element>
<xsd:element fixed="9" name="SpotID" type="xsd:string">
</xsd:element>
<xsd:element fixed="1" name="ApprovedStatus" type="xsd:string">
</xsd:element>
<xsd:element fixed="20" minOccurs="0" name="ProductDescription" type="xsd:string">
</xsd:element>
<xsd:element fixed="20" name="CommercialNUmber" type="xsd:string">
</xsd:element>
<xsd:element fixed="25" name="ComercialDescription" type="xsd:string">
</xsd:element>
<xsd:element fixed="15" name="IndustryCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="2" name="MobilityCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="2" name="PreempteeCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="2" name="PreemptorCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="3" name="PositionCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="11" name="StockLocation" type="xsd:string">
</xsd:element>
<xsd:element fixed="6" name="BreakID" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="ChannellFooter">
<xsd:sequence>
<xsd:element fixed="2" name="RecordCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="4" name="ChannelCode" type="xsd:string">
</xsd:element>
<xsd:element fixed="8" name="TXDate" type="xsd:string">
</xsd:element>
<xsd:element fixed="4" name="RecordCount" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="FileFooter">
<xsd:sequence>
<xsd:element fixed="2" name="RecordCode" type="xsd:string">
</xsd:element>
<xsd:element name="RecordCount" type="xsd:string">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Spot">
<xsd:sequence maxOccurs="1" minOccurs="1">
<xsd:element name="ChannelHeader" type="ChannellHeader">
</xsd:element>
<xsd:element maxOccurs="unbounded" name="SpotRecord" type="SpotRecord">
</xsd:element>
<xsd:element name="ChannellFooter" type="ChannellFooter">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SpotSchedule">
<xsd:sequence>
<xsd:element name="FileHeader" type="FileHeader">
</xsd:element>
<xsd:element maxOccurs="unbounded" name="Spots" type="Spot"/>
<xsd:element name="FileFooter" type="FileFooter">
</xsd:element>
</xsd:sequence>
</xsd:complexType>
<xsd:element name="SpotSchedule" type="SpotSchedule">
</xsd:element>
</xsd:schema>
|
[/quote] |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 18, 2008 1:30 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
am I missing something |
Yes, you will be relieved to hear that you are . You just need to describe the contents of 'fileHeader', 'recordHeader' etc using a complex type with Data Element Separation of 'Fixed Length' and add the apprpropriate members.
Revised example below ( with Group Terminators added, in case you missed that trick )
Code: |
element name="File"
complexType DES="Tagged Fixed Length", Tag Length="2", composition="Sequence"
element name="fileHeader", tag="00"
complexType DES="Fixed Length", composition="Sequence", GroupTerminator='<CR><LF>'
element name="fileHeader.1", length="8"
element name="recordHeader", tag="01"
complexType DES="Fixed Length", composition="Sequence", GroupTerminator='<CR><LF>'
element name="recordeader.1", length="8"
element name="recordeader.2", length="3"
element name="recordData", ...
|
I just looked at your mxsd. Looks as if you are (mis)using the 'Fixed' property as if it was an element length. Please note two things:
- 'Fixed' is a logical property of an element. It sets a fixed default value for the element. It is not used by the TDS parser at all.
- If you haven't realised it already, please note: WMB makes a rigid distinction between the logical and physical representations of a message. You should never have expected to set an element length in the logical properties. |
|
Back to top |
|
 |
matuwe |
Posted: Wed Jun 18, 2008 5:31 am Post subject: |
|
|
 Master
Joined: 05 Dec 2007 Posts: 296
|
yes... thanks a mill... It worked... I can read the header .. footer and all.
I have one last problem. One of my fileds, recordCount is not being read properly as the data file is sometimes incorrect.
03hhhhh25 the record count is length 4 but because sometimes it is send as 2 chars or 3 chars.... and no spaces at the end, my msgset reads it as 25\n\r. Is there anyway that I can read this field without fixed length? and take everything after .!!! |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jun 18, 2008 5:51 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Is there anyway that I can read this field without fixed length? and take everything after |
Yes.
1. Change the Data Element Separation of the parent complex type to 'Variable Length Elements Delimited'
2. Set the TDS length to 0 on the variable-length element
When DES='Variable Length Elements Delimited', any field with a length is treated as 'fixed length'. Any field without a length is treated as 'delimited', and will be terminated by the delimiters/group terminators of the parent structure(s) or by the end of the bitstream. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|