Author |
Message
|
sguruprasanna |
Posted: Tue Apr 19, 2005 8:02 am Post subject: Handling missing field in TDS |
|
|
 Apprentice
Joined: 29 Jul 2002 Posts: 37
|
Hi,
I am using MQSI 2.1 CSD 6. I have a TDS message containing 3 fields, each field delimited by a |, and the these fields would be repeating.
Sometimes in the input TDS msg, one ore more fields are missing.. For example, in the below message, the third field in the second line is missing:
1|2|3
4|5
6|7|8
How do I handle this? I tried attaching the Value Constraints - Default and Null Permitted to the third field. Also I tried setting Encoding Null as NullLiteralValue and then putting an empty string in Encoding Null Value for this field. None of them seem to work.
Can you please help me? Any pointers to this would also help..
thanks
Guru |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Apr 19, 2005 8:13 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You want to set the minimum occurances to 0. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Ramphart |
Posted: Tue Apr 19, 2005 9:13 am Post subject: |
|
|
 Disciple
Joined: 21 Jul 2004 Posts: 150 Location: South Africa, JHB
|
If you want the broker to throw an error when the field is missing:
-set min occurs = 1 on the connection tab of the message set
-set validate = content and value on the MQInput node under validation _________________ Applications Architect |
|
Back to top |
|
 |
kirani |
Posted: Tue Apr 19, 2005 9:42 pm Post subject: |
|
|
Jedi Knight
Joined: 05 Sep 2001 Posts: 3779 Location: Torrance, CA, USA
|
If the value is missing then don't you think that the delimiter should be present. _________________ Kiran
IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries
|
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 20, 2005 3:44 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
kirani wrote: |
If the value is missing then don't you think that the delimiter should be present. |
Excellent point!
How is the parser supposed to know if the first, second, or third field is missing in that second record? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
sguruprasanna |
Posted: Wed Apr 20, 2005 7:12 am Post subject: |
|
|
 Apprentice
Joined: 29 Jul 2002 Posts: 37
|
You guys are right. In the previous post, I missed to include the delimiter at the end of the second line, so the message I am using looks like:
1|2|3
4|5|
6|7|8
Still I am stuck.. Not sure what am I doing wrong here...
The error I am getting is:
Code: |
2005-04-20 10:11:52.008464 15 RecoverableException BIP2230E: Error detected whilst processing a message in node 'TEST.JAPAN.Compute1'.
The message broker detected an error whilst processing a message in node 'TEST.JAPAN.Compute1'. An exception has been thrown to cut short the processing of the message.
See the following messages for details of the error.
2005-04-20 10:11:52.008640 15 ParserException BIP5421S: Tagged Delimited Format parsing error
Current message : 'ORDERS'
Path to current element : '/ORDERS'
Offset from start of message : 30
See following errors for more details.
2005-04-20 10:11:52.008692 15 ParserException BIP5288E: MRM parsing error. Message bit stream larger than expected.
The bit stream of the message being parsed by the MRM parser is larger than expected for a message of this message type.
The message bit stream has been incorrectly constructed, or the logical model is incorrect.
Ensure that the message is correctly packaged.
Ensure that the message properties are correct.
Ensure that the logical model for this message type is complete (the message set and message type should be quoted in previous messages).
|
My Message set looks like this:
Code: |
ORDERS_TYPE [compound type, TDS-Data Element Seperaation -All Elements Delimited, Delimiter-|]
---> has three elements: ORDER(STRING), ITEM(STRING), SPACE(STRING) -- all with default values
ORDERS [Compound, TDS-Data Element Seperation -All Elements Delimited, Delimiter-|]
---> Contains an element RECORD_ORDER of type ORDERS_TYPE(defined above) [Repeating=YES, Repeating Element Delimiter-<CR><LF>]
|
The simpe flow I use consists of MQInput --->Compute---->MQOutput
The ESQL code I am using is:
Code: |
DECLARE C INTEGER;
SET C = CARDINALITY(InputRoot.*[]);
DECLARE I INTEGER;
SET I = 1;
WHILE I < C DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I=I+1;
END WHILE;
-- Enter SQL below this line. SQL above this line might be regenerated, causing any modifications to be lost.
Set OutputRoot.Properties.MessageDomain = 'XML';
Set OutputRoot.Properties.MessageSet = '';
Set OutputRoot.Properties.MessageType = '';
Set OutputRoot.Properties.MessageFormat = 'MQSTR';
declare c integer;
declare c1 integer;
set c1 = 1;
set c = cardinality("InputBody"."RECORD_ORDER"[]);
while( c1 <= c) do -- {
set OutputRoot."XML"."MSG"."Record"[c1]."Space" = "InputBody"."RECORD_ORDER"[c1]."SPACE";
set c1 = c1 + 1;
end while; -- }
|
Am I missing anything here? I tried setting minimum occurence to 0 for the third field (SPACE) in the repeating Compound type... still it doesnt work. Please help...
regards
Guru |
|
Back to top |
|
 |
migerrits |
Posted: Wed Apr 20, 2005 9:33 am Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2002 Posts: 35 Location: Canada
|
I'm getting the same "larger than expected" message for my message flow. Everything about the data defn checks out, so I'm puzzled as to what it could be. It works fine for one row... |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 20, 2005 9:40 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
migerrits wrote: |
Everything about the data defn checks out, so I'm puzzled as to what it could be. It works fine for one row... |
It works fine for one row because you have not properly indicated that there should be more than one row. This is why it says that there the bitstream is larger than expected - because it expected one row, and found that row, and then found the rest of the rows.
You do not have your repeating structure set up correctly, or delimited correctly. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
migerrits |
Posted: Wed Apr 20, 2005 10:26 am Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2002 Posts: 35 Location: Canada
|
I fixed my problem... Almost.
My input data should look like this, delimited by pipe ("|") and <CR><LF>:
"data1|data2|data3|...|dataN-1|dataN<CR><LF>"
However, I'm not passing data in all of the fields:
"data1|data2|data3|...|dataN-1|<CR><LF>"
Simply by adding a space to the end, it was ok:
"data1|data2|data3|...|dataN-1| <CR><LF>"
I'm thinking I need to tell it that it is OK to not have all of the elements, which I *thought* I had already done?
-m |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Apr 20, 2005 10:37 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
TDS doesn't like having the final field in a group being optional.
You may have some difficulties resolving this. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
migerrits |
Posted: Wed Apr 20, 2005 11:01 am Post subject: |
|
|
 Apprentice
Joined: 13 Dec 2002 Posts: 35 Location: Canada
|
jefflowrey wrote: |
TDS doesn't like having the final field in a group being optional.
You may have some difficulties resolving this. |
That's just ugly.
I'm lucky in that I believe my final field will never be empty but I don't want to take any chances while I'm coding it. Our friend above may have to resort to using a space for that final field.
-m |
|
Back to top |
|
 |
sguruprasanna |
Posted: Wed Apr 20, 2005 11:41 am Post subject: |
|
|
 Apprentice
Joined: 29 Jul 2002 Posts: 37
|
|
Back to top |
|
 |
sguruprasanna |
Posted: Wed Apr 20, 2005 2:43 pm Post subject: |
|
|
 Apprentice
Joined: 29 Jul 2002 Posts: 37
|
At last I found that it works on MQSI2.1 with when CSD 7...
Ultimately it was because of a limitation with the earlier versions I guess?????? |
|
Back to top |
|
 |
|