|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Stupid ESQL Q: What's the type for InputRoot and OutputRoot? |
« View previous topic :: View next topic » |
Author |
Message
|
matoh |
Posted: Thu Mar 02, 2006 7:58 am Post subject: Stupid ESQL Q: What's the type for InputRoot and OutputRoot? |
|
|
Apprentice
Joined: 04 Mar 2005 Posts: 26
|
If you want to pass InputRoot and OutputRoot as arguments to a function or procedure, what should the procedure/function argument types be declared as?
Assuming something simple as the ever-present:
Code: |
CREATE COMPUTE MODULE SetSomeHeaders
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
--CALL CopyMessageHeaders();
CALL CopyEntireMessage();
SET OutputRoot.MQRFH2.usr.foo = 'FOO';
SET OutputRoot.MQRFH2.usr.bar = 'BAR';
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER CARDINALITY(InputRoot.*[]);
WHILE I < J DO -- Not I <= J, since we want to skip the last index, which is the body.
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
END MODULE;
|
If you want to lift out CopyMessageHeaders() and CopyEntireMessage() outside the module, then you have to declare InputRoot and OutputRoot as parameters to them:
Code: |
CREATE PROCEDURE CopyEntireMessage(IN MyInputRoot [...], INOUT MyOutputRoot [...]) BEGIN
SET MyOutputRoot = MyInputRoot;
END;
|
What types should be in the in the "[...]" placeholders? |
|
Back to top |
|
 |
hemendra123 |
Posted: Thu Mar 02, 2006 8:28 am Post subject: |
|
|
Novice
Joined: 30 May 2005 Posts: 20
|
matoh, Usage of 'REFERENCE' will help you.
Use the below signature for the case you mentioned.
CREATE PROCEDURE CopyEntireMessage(IN MyInputRoot REFERENCE, INOUT MyOutputRoot REFERENCE) |
|
Back to top |
|
 |
matoh |
Posted: Thu Mar 02, 2006 8:37 am Post subject: |
|
|
Apprentice
Joined: 04 Mar 2005 Posts: 26
|
I tried REFERENCE, but got a "Routine not declared for these arguments" compile error.
I just realized it was because I had forgotten to add the library project in which the procedure was declared to the project in which I tried to used it, so I was out on a red herring chase...
Thanks for setting me on the correct path again! |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|