Author |
Message
|
Sridar |
Posted: Thu Jun 15, 2006 11:28 pm Post subject: CopyMessageHeaders Procedure |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Hi
I have a flow with 4 Compute Node and 3 Filter nodes divided over 3 Label nodes( i mean connected to 3 label nodes).
I am referencing some procedures from a common flow.
Each compute node and Filter node will have the CopyMessageHeaders(created by WBI by default)
I want to know if instead of having this CopyMessageHeaders Procedure in each node can i have it in the commonflow and reference it.
Since the Copy Message Header code is same for all nodes
This would reduce the code length.
Sridar _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Jun 15, 2006 11:35 pm Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Sridar,
Ofcourse u can...
U can create a new ESQL file...perhaps name it like UTILITY or COMMON etc...paste the common methods there.
If this ESQL file is within the same schema then u can reference it directly from any other ESQL file within the same schema...
If the ESQL file is in another schema, then u will need to add a line in the ESQL where u want to reference it, as
Code: |
PATH <name of schema containing the COMMOM> |
or
Code: |
CALL <Schema name>.CopyMessageHeaders |
Regards. |
|
Back to top |
|
 |
Sridar |
Posted: Fri Jun 16, 2006 12:59 am Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Thanks elvis,
Will try and let you know
Sridar _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
Sridar |
Posted: Fri Jun 16, 2006 1:49 am Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Hi
I tried doing that but am not successful.
How will i pass the input message.
Also since i need to return an output i thought of converting it into a function but i am getting Syntax Error when i am trying to call the function from main flow.
Below is the original code created by WBI
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;
This is how i changed it into a function in the common flow.
CREATE FUNCTION CopyMessageHeaders(InputRoot CHARACTER, OutputRoot CHARACTER) RETURNS CHARACTER
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;
RETURN OutputRoot;
END;
This is how i call it in the main flow
CopyMessageHeaders(InputRoot,OutputRoot);
Can i pass the message to a function by specifying as InputRoot? if not how can i pass it without involving complex logic like converting to BLOB and then converting back.
By the way i forgot to mention my Input message is of XML format.
Sridar _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Jun 16, 2006 2:17 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Sridar,
Sridar wrote: |
Also since i need to return an output i thought of converting it into a function but i am getting Syntax Error when i am trying to call the function from main flow. |
Use:
Code: |
IN InputRoot CHARACTER, INOUT OutputRoot CHARACTER) RETURNS CHARACTER |
If you still get an error then add the line schema name before the call.
Regards. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Jun 16, 2006 2:35 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
InputRoot and OutputRoot are certainly not CHARACTER variables, and you should know that elvis_gn!
Please search here for all of the other times this question has been asked. I'm sure you'll find a good reference in there somewhere. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
elvis_gn |
Posted: Fri Jun 16, 2006 3:04 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
jefflowrey wrote: |
InputRoot and OutputRoot are certainly not CHARACTER variables, and you should know that elvis_gn!
Please search here for all of the other times this question has been asked. I'm sure you'll find a good reference in there somewhere. |
Oh God ! I was not at all concentrating on that...sorry...my mistake...I was bothering only about the INOUT..didnt notice that.
Regards. |
|
Back to top |
|
 |
JT |
Posted: Fri Jun 16, 2006 11:13 am Post subject: |
|
|
Padawan
Joined: 27 Mar 2003 Posts: 1564 Location: Hartford, CT.
|
Jeff wrote: |
I'm sure you'll find a good reference in there somewhere. |
You forgot to bold it, underline it and blink it.  |
|
Back to top |
|
 |
fjb_saper |
Posted: Sat Jun 17, 2006 5:34 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
And don't forget to specify the domain when creating in a generic procedure.
You have to use the CREATE command and add the DOMAIN information (V6) otherwise the parser won't be valid.
Use the search button, there was an exemple posted in the last month or so...
Enjoy...  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Sridar |
Posted: Mon Jun 19, 2006 1:56 am Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Thanks Guys for all your support.
And sorry for replying late. Was out on a weekend.
Actually i am having only an ESQL file in the commonflow i mentioned.
Cos i just wanted to have all the common procedures seperately.
There is no message flow which means no compute,filter or database nodes to assosiate the code with.
I think i can't pass a message to an Esql file which is not related to any node.
Any case will check for any existing reference.
As of now there is no progress. _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Jun 19, 2006 3:18 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Sridar,
Sridar wrote: |
I think i can't pass a message to an Esql file which is not related to any node.
|
You can create an ESQL file without having a node related to it.
Regards. |
|
Back to top |
|
 |
Sridar |
Posted: Mon Jun 19, 2006 3:28 am Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Elvis,
I have already done that
I was asking whether i can pass a XML Message(InputRoot) to the CopyMessageHeaders Procedure in that ESQL file.
Sridar _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
elvis_gn |
Posted: Mon Jun 19, 2006 3:37 am Post subject: |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi Sridar,
Sridar wrote: |
I was asking whether i can pass a XML Message(InputRoot) to the CopyMessageHeaders Procedure in that ESQL file |
If you noticed Jeff's post, you would have realised he was refering to REFERENCE.
Use CopyMessageHeaders(IN InputRoot REFERENCE, INOUT OutputRoot REFERENCE)
I hope i'm right, this time around.
Regards. |
|
Back to top |
|
 |
Sridar |
Posted: Mon Jun 19, 2006 4:10 am Post subject: |
|
|
Acolyte
Joined: 14 May 2006 Posts: 72 Location: Chennai, India
|
Elvis:
I thought Jeff was mentioning that there could be some Post which i could refer.
All:
I tried the method of using REFERENCE but i am getting error in the debugger referring to this statement CALL CopyMessageHeaders(InputRoot,OutputRoot); and indicates that the problem is with OutputRoot.
Can i just say "CALL CopyMessageHeaders(InputRoot,OutputRoot); " or do i have to any manipulations to pass OutputRoot.
Sridar _________________ Thanks and Regards
Sridar |
|
Back to top |
|
 |
jefflowrey |
Posted: Mon Jun 19, 2006 4:27 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Can you be more explicit about what the debugger says? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|