Author |
Message
|
raghug |
Posted: Fri Jun 15, 2007 6:38 am Post subject: Problem With PROPAGATE Statement |
|
|
Acolyte
Joined: 19 Jul 2006 Posts: 60 Location: NJ
|
Hi All
When I used PROPAGATE Statement I got Exception Please correct my Esql if any mistake ...
CALL CopyMessageHeaders();
-- SET OutputRoot.XML.Book_Order_Response_MSG = InputRoot.XML.Create_Book_Order_MSG;
SET OutputRoot.XML.Book_Order_Response_MSG.Customer_ID = InputRoot.XML.Create_Book_Order_MSG.Customer_ID;
DECLARE input TIMESTAMP InputRoot.XML.Create_Book_Order_MSG.Order_Date;
DECLARE pattern CHARACTER 'yyyyMMddHHmmss';
DECLARE orderDate CHARACTER CAST(input AS CHARACTER FORMAT pattern);
SET OutputRoot.XML.Book_Order_Response_MSG.Order_Number = InputRoot.XML.Create_Book_Order_MSG.Customer_ID || orderDate;
SET OutputRoot.XML.Book_Order_Response_MSG.Order_Date = InputRoot.XML.Create_Book_Order_MSG.Order_Date;
DECLARE deliveryPrice DECIMAL;
IF InputRoot.XML.Create_Book_Order_MSG.First_Class = 'Yes' THEN
SET OutputRoot.XML.Book_Order_Response_MSG.First_Class = InputRoot.XML.Create_Book_Order_MSG.First_Class;
SET deliveryPrice = 18.00;
END IF;
IF InputRoot.XML.Create_Book_Order_MSG.Second_Class = 'Yes' THEN
SET OutputRoot.XML.Book_Order_Response_MSG.Second_Class = InputRoot.XML.Create_Book_Order_MSG.Second_Class;
SET deliveryPrice = 12.00;
END IF;
IF InputRoot.XML.Create_Book_Order_MSG.Airmail = 'Yes' THEN
SET OutputRoot.XML.Book_Order_Response_MSG.Airmail = InputRoot.XML.Create_Book_Order_MSG.Airmail;
SET deliveryPrice = 8.00;
END IF;
DECLARE bookCount INTEGER;
DECLARE numBooks INTEGER;
DECLARE sumBookPrice DECIMAL 0;
SET bookCount = 1;
SET numBooks = CARDINALITY(InputRoot.XML.Create_Book_Order_MSG.Book_Details.ISBN[]);
WHILE bookCount<= numBooks DO
SET sumBookPrice = sumBookPrice + CAST(InputRoot.XML.Create_Book_Order_MSG.Book_Details.Book_Price[bookCount] AS DECIMAL);
SET OutputRoot.XML.Book_Order_Response_MSG.Book_Details[bookCount].ISBN = InputRoot.XML.Create_Book_Order_MSG.Book_Details.ISBN[bookCount];
SET OutputRoot.XML.Book_Order_Response_MSG.Book_Details[bookCount].Book_Price = InputRoot.XML.Create_Book_Order_MSG.Book_Details.Book_Price[bookCount];
SET bookCount = bookCount + 1;
END WHILE;
SET OutputRoot.XML.Book_Order_Response_MSG.Delivery_Price = deliveryPrice;
SET OutputRoot.XML.Book_Order_Response_MSG.Total_Price = sumBookPrice;
SET OutputRoot.XML.Book_Order_Response_MSG.Order_Status = 'Order Received';
-- CALL CopyEntireMessage();
PROPAGATE ;
PROPAGATE TO TERMINAL 'out1' ;
RETURN TRUE;
END;
Please Help me |
|
Back to top |
|
 |
pcelari |
Posted: Fri Jun 15, 2007 6:56 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
to propagate to a terminal other than 'out', you have to return false.
...
PROPAGATE TO TERMINAL 'out1' ;
RETURN false;
Also why do you propagate twice? _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
kspranava |
Posted: Fri Jun 15, 2007 7:06 am Post subject: |
|
|
 Centurion
Joined: 27 Apr 2003 Posts: 124
|
Hi raghug,
Whats the exception?
As mentioned by pcelari, once propagation is successful, return false.
I assume, you are using two propagates intentionally. If not otherwise, set the delete clause of first propagate to none.
Excerpts from help:
If DELETE is set to DEFAULT, or the DELETE clause is absent, the output local environment, message, and exception list are all cleared and their memory recovered immediately after propagation.
Thanks,
kspranava. |
|
Back to top |
|
 |
raghug |
Posted: Fri Jun 15, 2007 7:07 am Post subject: why do you propagate twice? |
|
|
Acolyte
Joined: 19 Jul 2006 Posts: 60 Location: NJ
|
Thanks for u r replay
I need Multiple out put messages becouse ot that I used PROPAGET Statement
Thanks
WIN |
|
Back to top |
|
 |
pcelari |
Posted: Fri Jun 15, 2007 7:18 am Post subject: |
|
|
Chevalier
Joined: 31 Mar 2006 Posts: 411 Location: New York
|
you don't need explicit propagate for multiple output. why don't you just wire the same out terminal to multiple destinations? _________________ pcelari
-----------------------------------------
- a master of always being a newbie |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Jun 15, 2007 8:13 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi raghug,
Irrespective of how many times you want to propagate, or what u actually want to achieve as per business logic, the exception must be becoz of the following
Code: |
PROPAGATE ;
PROPAGATE TO TERMINAL 'out1' ; |
After the first propagate, the msg tree has got deleted, thats why the second propagate is erroring out...
You should use DELETE NONE with your first propagate if you want to make another propagate WITHOUT creating the tree again...
Regards. |
|
Back to top |
|
 |
raghug |
Posted: Fri Jun 15, 2007 8:25 am Post subject: Yes you are correct |
|
|
Acolyte
Joined: 19 Jul 2006 Posts: 60 Location: NJ
|
Thanks for you and all help me |
|
Back to top |
|
 |
|