Author |
Message
|
cloucas |
Posted: Fri Mar 10, 2006 1:44 am Post subject: TDS Questions |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
I am integrating a host application using tagged delimited message with an Oracle application. In designing the host-side interface, I have defined a number of tagged elements along with their tags and lengths, as each is fixed length. I have also defined the messages using these elements.
The messages consist of two header structures (fixed length) and then a variable length structure composed of a number of tagged delimited fields. Finally a number of spaces (sent by the host) follows which I try to get by adding another fixed length filler.
I have the following questions:
1.How do I declare a tagged element as packed decimal? It seems that I can readily do it in CWF but there is no choice available in TDS.
2. Is it possible to have a number of these elements not present at certain instances of the message and present at some others? I have defined all elements as minOccurs = 0 and maxOccurs = 1. Is that OK? Also is it possible to have some fields appearing more than once?
3. I keep getting an error that the bit stream is larger than expected. Since the message itself consists of a number of elements, some of which may or may not appear, how can i know the length of the message? I have defined a fixed length filler as the final part of the message and don't know to what the length of this should be.
Thanks
Chris |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 10, 2006 2:01 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
Quote: |
1.How do I declare a tagged element as packed decimal? It seems that I can readily do it in CWF but there is no choice available in TDS. |
Not very sure of what your trying to achieve in this element. A little more elaboration.
Quote: |
Is it possible to have a number of these elements not present at certain instances of the message and present at some others? |
Yes, If you specify the min occurs as 0 then that means that it may occur or may not occur.
Quote: |
Also is it possible to have some fields appearing more than once? |
Yes, if its just one element and you know that it repeats at one location, you can make the max occurs as whatever, say 100....if you are ok with spaces or something for the non occuring fields then the above is fine,
but if u dont want the spaces or commas for example, for the non occuring fields,then create a complex type and define a delimiter for this repeatig field.
If its a group of elements repeating, then put then all in a complex type and make the occurance of the complex type as more than 1.
Quote: |
how can i know the length of the message? |
If you are using variable length fields, then how can you know the length of the message...u can't.
Define the segment as Variable length....not sure,look in the dropdown menu in message set properties...
If you really need to find the lenght of the message then you'll need to do this in a compute node.
Regards. |
|
Back to top |
|
 |
cloucas |
Posted: Fri Mar 10, 2006 2:18 am Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks for your swift response.
Not very sure of what your trying to achieve in this element. A little more elaboration
The Host response may include some amounts and balances. Since the host is a mainframe, these numbers are packed decimal type. I will have to parse these and then pass them to the Oracle application as normal decimal numbers. I have tried declaring them as decimals but the parser failed.
If you are using variable length fields, then how can you know the length of the message...u can't.
Define the segment as Variable length....not sure,look in the dropdown menu in message set properties...
If you really need to find the lenght of the message then you'll need to do this in a compute node.
The host response is composed of the two headers (with no tags) followed by the body of the message which consists of a number of tagged elements. After the last tagged element the host appends a number of spaces to complete 4448 bytes and sends the message. I would like to disregard the trailing spaces as I have no use for them. I am looking for a way to do this. Please note here that I cannot use a compute node as the parser fails in the MQ Input node:
2006-03-10 11:22:24.097209 2088 ParserException BIP5421S: Tagged/Delimited String Format (TDS) parsing error
Current message : 'r7033'
Path to current element : '/r7033'
Offset from start of message : 3945
See following errors for more details.
2006-03-10 11:22:24.097309 2088 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.
Thanks
cloucas
|
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 10, 2006 2:54 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
I haven't faced the first issue as yet, so i'm not very sure, but I found many posts relating it, you could try them....if eventually nothing seems to work, make the field a string and fix it in the code
http://www.mqseries.net/phpBB2/viewtopic.php?t=16029&highlight=packed+decimal
Quote: |
composed of the two headers |
Are the two headers of variable length or fixed length...
Quote: |
body of the message which consists of a number of tagged elements. After the last tagged element the host appends a number of spaces to complete 4448 bytes and sends the message. |
Since the fields are tagged you can use Variable length Tag Delimited structure.
I am guessing that the spaces will not be have a tag before them, if not then trim the last field of spaces.....
or if the last field and spaces are seperated by a tag, then define an extra field, use a trim on it and throw it off later.
Regards. |
|
Back to top |
|
 |
cloucas |
Posted: Fri Mar 10, 2006 3:03 am Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks for your response.
I will try the links.
How do I trim the spaces off the last field?
Regards
cloucas |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 10, 2006 3:22 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
Quote: |
How do I trim the spaces off the last field? |
In the message set properties, you can find a Trim Fixed Len String. Set it to Trim padding Chars....mention the padding char in the element property page as SPACE.
I am not very sure if it only works only on Fixed Length Strings
Try it out, and let me know too
If it dosen't then pick up the entire thing as a field and then remove it in a compute.
Regards. |
|
Back to top |
|
 |
cloucas |
Posted: Fri Mar 10, 2006 3:44 am Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks
I will try that. In the meantime does the order in which the tagged elements appear in the message matter?
Regards
cloucas |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Mar 10, 2006 3:55 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
Quote: |
I will try that. In the meantime does the order in which the tagged elements appear in the message matter? |
Yes it does, else the wrong value will come at the wrong field, unless you are using tag:value kind of message set.
You do have opdered set options, but i think that will put the fields in order when you send an output message...can't use this on an input message.
Regards. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 10, 2006 4:35 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
elvis_gn is pretty much correct in everything he has said. However, just to confirm a couple of points:
Quote: |
1.How do I declare a tagged element as packed decimal? It seems that I can readily do it in CWF but there is no choice available in TDS. |
Sorry - packed decimal is only available in the CWF format ( which does not support tagged or delimited fields)
Quote: |
Is it possible to have a number of these elements not present at certain instances of the message and present at some others?...
Also is it possible to have some fields appearing more than once?
|
Any tagged field can occur any number of times ( including zero times ) and this is independent of your maxOccurs property (although you might want to set maxOccurs to make the model look right, or to allow validation of your messages). Delimited fields without tags can only be omitted if they come at the end of the structure (obviously). Fixed Length fields must occur exactly the specified number of times (obviously).
Quote: |
I keep getting an error that the bit stream is larger than expected |
The MRM parsers will always throw a parsing exception if they reach the end of the message definition and there is still bitstream left over ( you will get BIP5288 ). This is almost certainly being caused by the trailing spaces. I would suggest that you get the message as a BLOBL and strip off the trailing spaces with some ESQL before re-parsing using the MRM. Alternatively, if you know which element will come last, set its padding character to space, as elvis_gn suggests. |
|
Back to top |
|
 |
kimbert |
Posted: Fri Mar 10, 2006 7:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
In the meantime does the order in which the tagged elements appear in the message matter? |
No, because they are tagged. Just set the Composition property on the parent complex type to UnorderedSet. |
|
Back to top |
|
 |
cloucas |
Posted: Sun Mar 12, 2006 11:01 pm Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks Kimbert
Regarding the packed decimal fields, what do you propose I do to handle this?
Regarding the "Bitstream Larger than expected" error please note that the blanks follow the last tagged field, which is defined as string and may also hold spaces. If I were to trim all spaces, I am afraid that the field data itself will be trimmed as well and I may have a parsing error due to data length being less than expected.
Any comments?
Thanks
cloucas |
|
Back to top |
|
 |
cloucas |
Posted: Mon Mar 13, 2006 12:32 am Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks for your input guys.
I changed the Input Node Property to BLOB parsing and added a Compute Node after it, with the following ESQL:
CREATE COMPUTE MODULE Response_From_Host_7033_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
CALL CopyEntireMessage();
SET OutputRoot = SUBSTRING("OutputRoot"."BLOB"."BLOB" FROM 1 FOR 1725);
SET OutputRoot.Properties.MessageSet='messageSetResponse';
SET OutputRoot.Properties.MessageFormat='ELSResponseTDS';
SET OutputRoot.Properties.MessageType='r7033';
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
How do I now parse the message using MRM? |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Mar 13, 2006 12:38 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
If you define the spaces to a field and then trim it also, it will not be an error.
Quote: |
I am afraid that the field data itself will be trimmed as well |
When you say trim spaces how will the data be trimmed off
If you use BLOB and then sit and parse, you will not be validating your message and your flow will accept even wrong messages....
If you have an input message set, then use the MRM parser in the input node itself and avoid coding the whole thing...
Regards. |
|
Back to top |
|
 |
cloucas |
Posted: Mon Mar 13, 2006 1:28 am Post subject: |
|
|
Apprentice
Joined: 10 Mar 2006 Posts: 37
|
Thanks elvis_gn
I too prefer parsing using the MRM. However, the message is composed of two fixed length structures, followed by a structure (body) composed of a number of teg delimited fields. The host sends this message and then appends trailing spaces (HEX 40) to a length of 4448 bytes. What I have done is that I have created another structure to follow the body. I however get the MRM parsing error that the bitstream is larger than expected.
How should I define that last structure to be used for parsing the blanks?
Tks
cloucas |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Mar 13, 2006 1:58 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi cloucas,
Bitstream is larger means that, when the message was being parsed into the structure that you provided, few characters have been found extra.
Quote: |
How should I define that last structure to be used for parsing the blanks? |
You cannot define that, you will just have to make sure that all the characters before the blanks are placed perfectly into the fields before this structure.
You can mail me(elvninan@in.ibm.com) the set and the sample that you have, I can try to fix it for you...
Regards. |
|
Back to top |
|
 |
|