ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Stupid ESQL Q: What's the type for InputRoot and OutputRoot?

Post new topic  Reply to topic
 Stupid ESQL Q: What's the type for InputRoot and OutputRoot? « View previous topic :: View next topic » 
Author Message
matoh
PostPosted: Thu Mar 02, 2006 7:58 am    Post subject: Stupid ESQL Q: What's the type for InputRoot and OutputRoot? Reply with quote

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
View user's profile Send private message Send e-mail
hemendra123
PostPosted: Thu Mar 02, 2006 8:28 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
matoh
PostPosted: Thu Mar 02, 2006 8:37 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Stupid ESQL Q: What's the type for InputRoot and OutputRoot?
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.