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 » FOR ALL

Post new topic  Reply to topic
 FOR ALL « View previous topic :: View next topic » 
Author Message
tammy
PostPosted: Thu Apr 24, 2008 6:59 am    Post subject: FOR ALL Reply with quote

Newbie

Joined: 24 Apr 2008
Posts: 5

The "Writing ESQL" manual in the information center includes the following example:

FOR ALL Body.Invoice.Purchases."Item"[]
AS I (I.Quantity <= 50)

Whenever I enter it, the toolkit flags the ALL with an exclamation mark:

CREATE FILTER MODULE TFlow1_Filter
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
FOR ALL Body.Invoice.Purchases."Item"[]
AS I (I.Quantity <= 50)
RETURN TRUE;
END;

END MODULE;

The compilation fails reporting that there are errors in the project. If I comment out the two lines containing the FOR ALL and AS IS, everything is fine.

Why is the ALL keyword being flagged as a error?
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Apr 24, 2008 7:10 am    Post subject: Re: FOR ALL Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

tammy wrote:
The compilation fails reporting that there are errors in the project. If I comment out the two lines containing the FOR ALL and AS IS, everything is fine.


Pedantically, it's not AS IS, it's AS I as correctly shown in your code.

What is your code trying to achieve? Where does the return value from the FOR ALL get evaluated?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
tammy
PostPosted: Thu Apr 24, 2008 7:30 am    Post subject: Reply with quote

Newbie

Joined: 24 Apr 2008
Posts: 5

CREATE FILTER MODULE TFlow1_Filter
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
DECLARE X INTEGER;
SET X = 0;
FOR ALL Body.Invoice.Purchases."Item"[]
AS I (I.Quantity <= 50)
SET X = X + I.Quantity;
IF X > 0 THEN
RETURN TRUE;
END;

Sorry - put the latest version in (which is still being flagged as an error on the FOR ALL). The function should go through a structure and filter to TRUE if any Quantities were <= 50. I still don't understand why FOR ALL is being flagged as an error.
Back to top
View user's profile Send private message
mgk
PostPosted: Thu Apr 24, 2008 8:31 am    Post subject: Reply with quote

Padawan

Joined: 31 Jul 2003
Posts: 1642

ESQL has a FOR Function and a FOR Statement. The Function (which is the syntax you are trying to use) can only be used as part of a larger expression. It cannot be used as a Statement (which you are trying to do). Instead the FOR Statement can be used if you want to perform Statements inside the FOR.

As the docs say:
Quote:
"The FOR field function evaluates an expression and assigns a resulting value of TRUE, FALSE, or UNKNOWN"


Where as the FOR Statement is used like this:
Code:
FOR source AS Environment.SourceData.Folder[] DO
 --statements using source
END FOR;


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

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » FOR ALL
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.