Author |
Message
|
saikrishna |
Posted: Wed Jul 29, 2015 5:43 am Post subject: how to pass a list to procedure |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
Wanna pass list to procedure:
CALL Message(LIST{'a','b','c','d'});
Note: aoart from assigning list to array is there any other option? |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jul 29, 2015 5:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
IIB does not have arrays.
The sooner you believe that, the easier things will be.
It has logical message trees, and lists. Lists are only useful in very certain conditions.
What you see with [] are either elements in a logical message tree, or elements in a ROW. You should almost never access these by index. |
|
Back to top |
|
 |
saikrishna |
Posted: Wed Jul 29, 2015 6:16 am Post subject: |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
Am using WMB8
I can achieve this by using below statements
SET Environment.Variables.Mandatory.*[] = LIST{'a','b','c','d'};
DECLARE MANDATORY REFERENCE TO Environment.Variables.Mandatory;
Call Message(MANDATORY);
But my doubt is like is there any option to send LIST as a parameter? |
|
Back to top |
|
 |
saikrishna |
Posted: Wed Jul 29, 2015 6:18 am Post subject: |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
My requirement is like
Need to pass 'n' LIST's to a procedure(instead of assigning n LISTS to environment[]) |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Jul 29, 2015 6:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
saikrishna wrote: |
My requirement is like
Need to pass 'n' LIST's to a procedure(instead of assigning n LISTS to environment[]) |
Your requirement is to understand the difference between a LIST and a ROW.
And stop thinking about lists. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Jul 29, 2015 6:39 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
IIRC a procedure will take a reference as an argument but will not accept a list or a row.
As I said from memory. Look up the Knowledge Center for the proper reference.  _________________ MQ & Broker admin
Last edited by fjb_saper on Thu Jul 30, 2015 4:47 am; edited 1 time in total |
|
Back to top |
|
 |
saikrishna |
Posted: Thu Jul 30, 2015 2:19 am Post subject: |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
As per ur suggestions passing ROW instead of LIST
CREATE PROCEDURE CopyEntireMessage() BEGIN
DECLARE x ROW;
set x=ROW('a','b');
CALL CallMessage(x);
END;
CREATE PROCEDURE CallMessage (IN x ROW)
BEGIN
No errors, but while depploying into EG am getting below error:
Syntax error : 'keyword Row'.
The token caused a syntax error.
Correct the syntax of your ESQL expression in node '. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Jul 30, 2015 4:49 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Which part of "you cannot use a list or a row as argument to a procedure" did you not understand?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
saikrishna |
Posted: Thu Jul 30, 2015 4:55 am Post subject: |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
Thanks
List I agree, but y not for ROW...
Any reason behind that..
then why it is suggesting ROW as parameter type when creating procedure.. |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Jul 30, 2015 4:57 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
saikrishna wrote: |
Thanks
List I agree, but y not for ROW...
Any reason behind that..
then why it is suggesting ROW as parameter type when creating procedure.. |
If autocomplete is doing that then it could be a bug. Raise a PMR with IBM. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
saikrishna |
Posted: Thu Jul 30, 2015 5:05 am Post subject: |
|
|
Novice
Joined: 29 Jul 2015 Posts: 21
|
Thanku all  |
|
Back to top |
|
 |
|