|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
prob. using data pattern for group delimiter in TDS. |
« View previous topic :: View next topic » |
Author |
Message
|
bableshwar81 |
Posted: Sun Dec 21, 2003 10:52 pm Post subject: prob. using data pattern for group delimiter in TDS. |
|
|
Newbie
Joined: 24 Nov 2003 Posts: 4 Location: INDIA
|
hi All,
Take a close look at this sample data..
Sample Data:
type1,....,fieldn/<SP>.....33 spaces...<SP><CR><CR><LF>
REC1,....,fieldn/<SP>.....35 spaces...<SP><CR><CR><LF>
REC2,....,fieldn/<SP>.....34 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC1,....,fieldn/<SP>.....35 spaces...<SP><CR><CR><LF>
REC2,....,fieldn/<SP>.....34 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
REC3,....,fieldn/<SP>.....32 spaces...<SP><CR><CR><LF>
type3,....,fieldn/<SP>.....34 spaces...<SP><CR><CR><LF>
This is a bit more complicated than the probelm i posted earlier.
I have a record structure with the following settings:
Baretype:-->Main_set
|-- Type1.....Compund type,Comma delimited,
|--Type2.....Compund type,Comma delimited,
|--Type3.....Compund type,Comma delimited,
For 'Main_set' :
Data Element Separation Property="All elements delimited by"
Delimiter: <CR><CR><LF>
'Type 1' represents start of file.
'Type 3' represents endof the file.
'Type 2' is of type Message_repeat.
Message_Repeat:
|---REC1
|---REC2
|---REC3
Message_repeat is a compound structure with records REC1,REC2,REC3. The data element seperation property is set to 'Data Pattern'. The records are repeating and can come in any order.
Structure of REC1:field1,field2,...,fieldn/<SP>....<SP><CR><CR><LF>
All the fields are delimited by commas and followed by slash,35 Spaces<SP> followed by <CR><CR><LF>
Group Delimiter:"/<SP>..35 times..<SP>
Structure of REC2:field1,field2,...,fieldn/<SP>....<SP><CR><CR><LF>
All the fields are delimited by commas and followed by slash,34 Spaces<SP> followed by <CR><CR><LF>
Group Delimiter:"/<SP>..34 times..<SP>
Structure of REC3:field1,field2,...,fieldn/<SP>....<SP><CR><CR><LF>
All the fields are delimited by commas and followed by slash,32 Spaces<SP> followed by <CR><CR><LF>
Group Delimiter:"/<SP>..32 times..<SP>
For all three records(REC1,2,3)
Data element seperation property: "All elements delimited "
Delimiter : comma(,)
Now the problem is:
Group delimiter property is not working ..
If type composition for type 2 is given as "sequence" then it accepts REC1,2,3 in sequence.....But if type composition is "choice"
and elements are repeatable(In any order) the above setting is not working......
Can any one help me out of this?? |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 22, 2003 4:39 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
If you want your model to resolve the choice for you, you'll have to give the parser some way of resolving the choice.
You don't say if you're using CWF or TDS (or even what version of WMQI you're using).
But, for this, you should be using TDS and enter in 'REC1', 'REC2', and 'REC3' as the Tags for the compound types that define those records. Then set the Type Composition to tagged fixed length, and set the type to "closed" rather than "open".
You'll have to change the tag length properties as well. And there will have to be some adjustments to the enclosing types. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
satish.kumar |
Posted: Mon Dec 22, 2003 10:15 am Post subject: |
|
|
Newbie
Joined: 04 Dec 2003 Posts: 9
|
Thanks Jeff,
I am bableshwar's friend..i will explain in detail..There is a little confusion in our way of explaining the Things. I hope i will be able to explain you more clearly.
First of all, i will answer the questions:
I am using TDS
We cant set the type to TAGGED FIXED LENGTH because, we want the data to be a element of the record.
The Sample Data is
01,abcdef,sksksks,031212,0000,001,80,1/<sp><sp>......<sp>(5 ti mes)/<CR><CR><LF> 02,sksksks,pppppp,1,031205,0000,GBP,0/<sp><sp>......<sp>(6 ti mes)/<CR><CR><LF> 03,60800900557846,GBP,15,000000208754400/<sp><sp>......<sp>(7 ti mes)/<CR><CR><LF> 04,399,000000020391500,,,,,01580120031206/<sp><sp>......<sp>(10 ti mes)/<CR><CR><LF>
03,60800900557846,GBP,15,000000208754400/ <sp><sp>......<sp>(7 ti mes)/<CR><CR><LF>
04,399,000000006094500,,,,,054801 20031206/>(10 ti mes)/<CR><CR><LF>
02,sksksks,pppppp,1,031205,0000,GBP,0/>(6 ti mes)/<CR><CR><LF>
04,399,000000000589000,,,,,055801 20031206/>(10 ti mes)/<CR><CR><LF>
04,399,000000004605000,,,,,056001 20031206/>(10 ti mes)/<CR><CR><LF>
02,sksksks,ppssksk,1,020202,0000,GBP,2/>(6 ti mes)/<CR><CR><LF>
99,8,7,6/
the records are type1,type2,type3,type16,type99
type1 will be the header--it comes only once
type2,type3,type04 can come in any order and any no. of times.
type99 will be the end-- it comes only once
now,
we have the structure as follows
basetype----
|--type01 record
|--body record
|--type02
|--type03
|--type16
|--type99 record
i.e., body record is a compound structure with type2,type3,type16 as its childs. base type has type1,repeat record, type99 as its childs.
for Body Record,
------------------
Now, we are setting the bodyrecord type composition to choice, and we are setting the data element separation property to use data pattern matching. We are setting the data pattern property for type02,type03,type16 as 02[^/]*,03[^/]*,16[^/]* respectively.
So, its able to resolve the choice based on the data pattern.
We have set the connection property in the repeat property to yes and made it to repeatable by setting max and minimum occurences.
for Base type--we have set the delimeter property as all elements delimeted by <CR><CR><LF>.
Our main problem is with the spaces we r having..after each record..
They are uneven for each record. But a particular type record will have same no. of spaces all the time.
for eg. type01 always has 5 spaces after /
type02 always has 6 spaces after / etc.
so, what i did was i have set the group delimeter prop for type01 to /<sp><sp>...<sp>5 times.
for type02, group delimeter is set to /<sp><sp>......<sp>(6 times).
for type03, group delimeter is set to /<sp><sp>......<sp>(7 times).
for type04, group delimeter is set to /<sp><sp>......<sp>(10 times)
and so on..
but the problem is it is parsing only upto 1 record after 01 record..it is not parsing the other records..i.e., it is parsing only 2 records.
Please Give me some idea on how to proceed..
Thanks Alot,
satish |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Dec 22, 2003 10:44 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Okay, I see.
Your records look like they end with <CR><CR><LF> (which is strange, but okay). So you need to include that in your model.
One way is to model the terminating spaces as a string element of the right width, and then set the group terminator to your line ending for all records. I would recommed doing it this way, as it is easier to change later if trailing spaces change - then you merely have to adjust the field width rather than having to retype the right number of spaces.
The other way is to include the line endings in the group terminator. That is, set your terminator to \SP(x times)<CR><CR><LF>.
Also keep in mind that the TDS mnemonics are probably case sensitive, that "<cr>" is not the same as "<CR>". _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
satish.kumar |
Posted: Tue Dec 23, 2003 2:37 am Post subject: |
|
|
Newbie
Joined: 04 Dec 2003 Posts: 9
|
hi jeff,
Thanks for all the ideas and support u r giving to us.
the first solution that u r talking should need a additonal field for each record. right? But I dont want to include additional field. thatz the main problem.
I tried out with the second one. But its not parsing. The Group delimeter is working when i set the body record type composition to sequence and data element separation property to all elements delimeted by <CR><CR><LF>. But actually i need the type composition to be set to choice. and it is not working if i set to type composition to choice.
It is parsing only the first record in the body record which is set to choice type. Then it is trying to take the 99th record. The repeat option that we have set for bodyrecord is not working. I think there is a problem with choice data type , repeat option with group delimeter. Because earlier i didnt have any spaces after / and it is working fine. so, i kept base type as all elements delimeted by /<CR><LF> and it is working fine with choice data type and repeat option. But when i added this group delimeter for records type2,type3,type16. it is not working. it is only parsing the first record in the choice type.
the group delimete is different for all the typesi.e.type2,type3,type16.
Can you throw us some light on why the group delimeter is not working fine with choice type and repeat option.? |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Dec 23, 2003 4:57 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You may also need to set the repeating item delimiter to your line ending. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
satish.kumar |
Posted: Wed Dec 24, 2003 8:23 am Post subject: |
|
|
Newbie
Joined: 04 Dec 2003 Posts: 9
|
hi jeff,
Sorry to trouble u again. There is a slight change in the requirement.
We have to parse a message set with a variable no. of spaces after each record. Will it be possible to do that with out additional field? Can we ignore the spaces after each record?
If that is not possible, may be i have to accept the message in BLOB format, write ESQL code first for deleting the spaces after /, and then parse using Reset Content Descriptor.
According to the modifications we have discussed, I have come up with the following parameters for the structure given below..please take your time..and tell me on which parameter to Change..thanks
STRUCTURE:BASETYPE----
|--TYPE01
|--BODYRECORD---
|--TYPE02
|--TYPE03
|--TYPE16
|--TYPE99
BASETYPE:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: <CR><CR><LF>
for TYPE01 record:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: ,
for body record:
TYPECOMPOSTION:choice
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: Use Data Pattern
DELIMETER: <CR><CR><LF>
REPEAT:YES
MIN:0
MAX:99999
REPEATING ELEMENT DELIMETER:<CR><CR><LF>
for type 03:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: ,
Data pattern: 02[^/]*
for type 16:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: ,
Data pattern: 03[^/]*
for type 03:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: ,
Data pattern: 03[^/]*
for type 99:
TYPECOMPOSTION:Sequence
TYPECONTENT :CLOSED
DATA ELEMENT SEPARATION: all elements delimited
DELIMETER: ,
Data pattern: 99[^/]*
We cant keep group delimeter because, we have variable no. of spaces...after each record.
Any new ideas?
Thanks alot,
satish |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Dec 24, 2003 8:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Please don't post AND private message me. One or the other, but not both.
I guess I don't understand why you don't want to include an element that holds the spaces.
It seems the right way to handle this, particularly if you make it an element that is a single character long. Then you can set it up for an unknown number of repeats.
Otherwise, you may be able to embed your actual record data inside another compound type that is an OPEN type. Then the spaces will be modelled as "extra" unnamed elements, without being explicit elements in your logical model. Use the '/' as the group delimiter for your body record, and use the <cr><cr><lf> as the delimiter for the new compound type.
But I can't give you much more specific information than that. I haven't worked with Open types.
Honestly, though, it would be a lot better if you could get the application that is creating these files to actually create something a lot more standard. But you know much better than I why that can or can't be done. _________________ I am *not* the model of the modern major general. |
|
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
|
|
|
|