Author |
Message
|
mustang |
Posted: Mon Mar 16, 2009 12:54 pm Post subject: Reference To Shared Variables |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
We want to create a common function or procedure that will refresh shared variables. This function/procedure would often be called from esql that is in a different schema (but will reference the schema in the path statement).
ESQL from calling function:
Declare CacheTable Shared Row;
Call setCacheTables('DB04', '0001', CacheTable);
ESQL from procedure
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, InOut CacheTable Reference)
Results in this runtime error:
bip2933 A function or procedure was called but the value supplied for the '&1' parameter was not a reference to a reference variable but the definition of the function/procedure requires a reference to a reference variable.
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, InOut CacheTable Row)
Results in this deploy time error:
BIP2402E: (hennepin.co.hjip.common.routines.setUTSTables, 1.7 : Syntax error : 'keyword Row'.
The token caused a syntax error.
Correct the syntax of your ESQL expression in node 'hennepin.co.hjip.common.routines.setUTSTables', around line and column '1.78', then redeploy the message flow.
Any suggestions would be much appreciated.
Thanks! |
|
Back to top |
|
 |
jharringa |
Posted: Mon Mar 16, 2009 12:57 pm Post subject: |
|
|
Acolyte
Joined: 24 Aug 2007 Posts: 70
|
I believe that you need to send in a message tree for this. You can't just send through a row. |
|
Back to top |
|
 |
Hari |
Posted: Mon Mar 16, 2009 1:22 pm Post subject: |
|
|
 Centurion
Joined: 21 Nov 2002 Posts: 117 Location: USA
|
The msg is self explanatory, you are passing a row instead of a reference. |
|
Back to top |
|
 |
mustang |
Posted: Tue Mar 17, 2009 5:48 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
I apologize. I was not as clear as I should have been. I understand the error messages. My question is, should I declare the shared variable as something other than ROW? If so, what should that be? Alternatively, is there a way for the ROW to be modified in the procedure?
Thanks! |
|
Back to top |
|
 |
jharringa |
Posted: Tue Mar 17, 2009 5:52 am Post subject: |
|
|
Acolyte
Joined: 24 Aug 2007 Posts: 70
|
You could pass a message tree into the procedure and then copy the resulting tree into the ROW. Unfortunately that will cost you a tree copy on top of your query. |
|
Back to top |
|
 |
mustang |
Posted: Tue Mar 17, 2009 5:55 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
|
Back to top |
|
 |
mustang |
Posted: Tue Mar 17, 2009 7:36 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
This worked:
Changed
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, InOut CacheTable Reference)
To this
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, In CacheTable Reference)
Thanks! |
|
Back to top |
|
 |
rekarm01 |
Posted: Tue Mar 17, 2009 1:46 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
mustang wrote: |
This worked:
Changed
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, InOut CacheTable Reference)
To this
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, In CacheTable Reference)
Thanks! |
Really?
I would have tried this:
Code: |
CREATE PROCEDURE setCacheTables (In db Char, In tableID Char, InOut CacheTable ROW) |
|
|
Back to top |
|
 |
jharringa |
Posted: Tue Mar 17, 2009 2:29 pm Post subject: |
|
|
Acolyte
Joined: 24 Aug 2007 Posts: 70
|
It doesn't appear to work for me (after some quick tests...). Maybe there has been a fix after 6.1.0.1?
 |
|
Back to top |
|
 |
whiting |
Posted: Mon Mar 30, 2009 9:45 am Post subject: Shared Variable |
|
|
Acolyte
Joined: 26 Mar 2002 Posts: 64 Location: Greenville, SC
|
Is there something special required to make the scope of the shared vriable Execution group. When I try to update the variable from flow2, It get's its own copy of the variable with an initial value of zero.
//Bill |
|
Back to top |
|
 |
mgk |
Posted: Mon Mar 30, 2009 1:47 pm Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Hello.
REFERENCE is the correct datatype to use here as ROWs cannot be passed to or from an ESQL Procedure or Function.
Kind Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
|