Filter stage does not work

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Filter stage does not work

Post by splayer »

I have a simple job:
Dataset--> Filter --> Dataset

The Where clause I have in the Filter stage is:
StringToDecimal(InputLink.InputCol) > 5

It gives the following error:
Filter_12: Parse error: Expected comparison, 'between', or 'like' operator, got: "("Parse error: Expected boolean operator (and, or) got: "A"

I did a search on this site for this error but it doesn't seem like there is a solution.
mansoor_nb
Participant
Posts: 48
Joined: Wed Jun 01, 2005 7:10 am

Post by mansoor_nb »

you can't use functions in the Filter stage.Also while filtering provide just the column name do not specify link name. for example:InputCol> 5.
splayer
Charter Member
Charter Member
Posts: 502
Joined: Mon Apr 12, 2004 5:01 pm

Post by splayer »

I can put in a transormer here and it'll do the job for me but I didn't want to do it because it seems like a filter is more appropriate for this purpose.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

One task, one stage. (Transformer excepted but, if you examine the code it generates, there's a heap of Orchestrate operators that might appear there.)

The Transformer stage can, of course, do what the Filter stage does in addition to the transformation. So, if you lose the Filter stage and set up multiple outputs from the Transformer stage, your functional requirement is still met. If you're on 7.5.1A or later, you probably have a more efficient solution as well.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

Some other options:

1) You could throw in a modify before the filter to handle the string to decimal conversion. Then in the filter you could use 'InputCol > 5'.

2) If there are only a few possible values, you could even leave it as a string. For example, if you just needed to find between 5 and 8 and the original type is a char(3), you could use the following:

Code: Select all

InputCol = '  5'
or
InputCol = '  6'
or
InputCol = '  7'
or
InputCol = '  8'
#2 is not the most glamorous way to do it, but will get the job done. Personally, if you are trying to avoid a Transformer, I think #1 might be the easiest.

Brad.
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

If you are on v7.5.1a or above, I'd personally go for single Transformer stage rather than using Modify plus Filter.
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

koolnitz wrote:If you are on v7.5.1a or above, I'd personally go for single Transformer stage rather than using Modify plus Filter.
Yes I would second that. We had few Filters in our application because we felt Filter fits in the role, but the IBM experts suggested otherwise. [to use a Parallel Transformer instead of a Filter, which can improve the performance and at the same time can do almost all the tasks needed]
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Helpful article: Is DS Parallel Transformer Evil?

Vincent quotes "Over my years of using parallel jobs I haven't noticed that much of an overhead and when you use the transformer for several tasks (transform, filter and copy) it can be faster."
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

koolnitz wrote:Helpful article: Is DS Parallel Transformer Evil?

Vincent quotes "Over my years of using parallel jobs I haven't noticed that much of an overhead and when you use the transformer for several tasks (transform, filter and copy) it can be faster."
Exactly...Until the Parallel Transformer, yes the BASIC Transformer was a drag. but the Parallel Transformer does all-in-one, if that's what is needed.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

IBM made several performance-related changes to the parallel Transformer stage in version 7.5.1A. If you have this or a later version prefer the Transformer stage to Filter or Switch. Modify and Copy, however, are still faster at doing the things they do.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply