Author |
Message
|
Devasis.Sahu |
Posted: Tue Mar 22, 2005 1:21 am Post subject: Force check for Output elements |
|
|
 Apprentice
Joined: 22 Feb 2003 Posts: 43 Location: India
|
Hi,
I have this requirement wherein, i need to check the sequence of output elements in my code and do that as a check before the output message can be generateds. for eg:
Output Format required:
E1
E2
E4
E3
Code has been written in the following format"
E2
E3
E4
E1
Now my question is , IS WBIMB intelligent enough to set the sequence of the elements in the require output format of E1, E2, E4 AND E3 even though the code has been written in different sequence ?
Regds |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 22, 2005 5:52 am Post subject: Re: Force check for Output elements |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Devasis.Sahu wrote: |
IS WBIMB intelligent enough to set the sequence of the elements in the require output format of E1, E2, E4 AND E3 even though the code has been written in different sequence ? |
NO!
Except.
But don't worry about the Except.
Write your code in the order you need the output.
ALWAYS. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Mar 22, 2005 6:01 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
For those times when it's not possible to set the output elements in their corrct order, the Composition type of Unordered Set is available.
Quote: |
Unordered Set
You can build elements of the output message in any sequence. On output, the elements will be written in the order specified in the logical message model definition.
|
|
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Mar 22, 2005 6:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
JT wrote: |
For those times when it's not possible to set the output elements in their corrct order, the Composition type of Unordered Set is available. |
That was the except.
What situations are there where it's not possible to set the elements in the correct order? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
JT |
Posted: Tue Mar 22, 2005 2:00 pm Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
When dealing with backend legacy COBOL applications in WBIMB, our input message structures contain numerous repeating groups, and quite often repeating groups within repeating groups. While constructing the elements of the output message, if the matching input field is located in a repeating group, and there are other elements in that repeating group that can be mapped to other output elements, we do so. We don't go back to that repeating group at a later time to extract those values. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 23, 2005 5:53 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
But you could do so. It just wouldn't make sense.
Even then, it wouldn't be too difficult, and probably not any more computationally expensive to prebuild the output tree, either using CREATE FIELD PARSE with a default record or a reference loop.
Then you wouldn't have to set your model up to improperly indicate that the structure of the groups is not order dependant.
But that's really not terribly important. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Devasis.Sahu |
Posted: Wed Mar 23, 2005 11:22 am Post subject: Force Checing |
|
|
 Apprentice
Joined: 22 Feb 2003 Posts: 43 Location: India
|
Gentlemen,
The "unordered set" proporty is not working. When i set the propoerty of the output message set to "unordered set" it doesnot help; The output message is still produced according to the coding sequence of the elements.
Please help. |
|
Back to top |
|
 |
JT |
Posted: Wed Mar 23, 2005 11:36 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Either you did it incorrectly or you're looking for the results prematurely.
Are you looking at the structure of the message as it sits in the destination queue or via a trace? |
|
Back to top |
|
 |
Devasis.Sahu |
Posted: Wed Mar 23, 2005 11:51 am Post subject: Please let me know where i am going wrong |
|
|
 Apprentice
Joined: 22 Feb 2003 Posts: 43 Location: India
|
Hello,
I will explain what i am doing :
I have an Input XML, which looks like this :
<ROOT1>
<NAME>dev</NAME>
<MARRIED>U</MARRIED>
<INCOME>1000</INCOME>
<PAN>12123</PAN>
</ROOT1>
I have one MQInput , followed by Compute and one MQOutput node. The code in the Compute node reads as follows:
CREATE COMPUTE MODULE testmsg_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
CALL CopyMessageHeaders();
--CALL CopyEntireMessage();
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageSet = 'MSCMN3C002001';
SET OutputRoot.Properties.MessageType = 'MSCMN3C002001';
SET OutputRoot.Properties.MessageFormat = 'XML';
SET OutputRoot.XML.ADDRESS.NAME = InputRoot.XML.ROOT1.NAME;
SET OutputRoot.XML.ADDRESS.MARRIED = InputRoot.XML.ROOT1.MARRIED;
SET OutputRoot.XML.ADDRESS.IDENTITY = InputRoot.XML.ROOT1.PAN;
SET OutputRoot.XML.ADDRESS.MONTHLY_INCOME= InputRoot.XML.ROOT1.INCOME;
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;
The sequence of the elements as define in the output message set is as follows:
Name, Monthly_income (mapped to Income),Married and Identity(mapped to PAN).
Now irrespective of the coding which has been deliberately changed to check the functionalitry, the output message which i am getting is as below:
<ADDRESS>
<NAME>dev</NAME>
<MARRIED>U</MARRIED>
<IDENTITY>12123</IDENTITY>
<MONTHLY_INCOME>1000</MONTHLY_INCOME>
</ADDRESS>
But i want the output message in the format given below:
<ADDRESS>
<NAME>dev</NAME>
<MONTHLY_INCOME>1000</MONTHLY_INCOME>
<MARRIED>U</MARRIED>
<IDENTITY>12123</IDENTITY>
</ADDRESS>
The above one matches the sequence as defined in the output message set.
I have tried with all the options in the message set, but it didnot give me the output as desired ( which shud have followed the message structure.
PLease let me know what needs to be done to achieve what i want.
Regds |
|
Back to top |
|
 |
Devasis.Sahu |
Posted: Wed Mar 23, 2005 11:53 am Post subject: |
|
|
 Apprentice
Joined: 22 Feb 2003 Posts: 43 Location: India
|
Read the headers as follows:
SET OutputRoot.Properties.MessageDomain = 'MRM';
SET OutputRoot.Properties.MessageSet = 'MSCMN3C002001';
SET OutputRoot.Properties.MessageType = 'msg_ADDRESS';
SET OutputRoot.Properties.MessageFormat = 'XML'; |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 23, 2005 11:56 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You're telling the Output message that it is in the MRM Domain, but then only populating data in the XML domain.
Use "Set OutputRoot.MRM." instead of "Set OutputRoot.XML.".
And don't use unordered set! Write your code in the order you want it!
Don't unecessarily limit your model because you're a lazy programmer! _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
Devasis.Sahu |
Posted: Wed Mar 23, 2005 12:00 pm Post subject: |
|
|
 Apprentice
Joined: 22 Feb 2003 Posts: 43 Location: India
|
You should appreciate the fact that i am only few weeks into WBIMB and still learning.... ) Thanx for the "Valuable" tip. |
|
Back to top |
|
 |
jefflowrey |
Posted: Wed Mar 23, 2005 12:10 pm Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Devasis.Sahu wrote: |
You should appreciate the fact that i am only few weeks into WBIMB and still learning.... ) Thanx for the "Valuable" tip. |
I do appreciate that. I could tell from your first question...
That's why I'm trying to give you good programming habits! If you were more experienced, or seemed more experienced, I'd have responded differently.
One of the good reasons for NOT using Unordered sets is that you DO get exceptions if you build your messages out of order. Then you know you've done something that the receiver won't like. If you use unordered sets, and someone rearranges the model accidentally or without the necessary communications and change processes , then you're going to get in trouble with the receiver, rather than having your dev tests fail. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|