constraints in transformer stage

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

constraints in transformer stage

Post by Luk »

Hello everybody!

I have following issue:

I want to test if input column1 is null, if yes I want to reject column (I do not want to have it in my output1)
I have transformer stage with 1 input and two outputs, also I have constraint defined for two outputs:

output1: IsNull(DSLink1.col1)
output2: REJECTED

also I have marked checkbox "reject row"

I don't get what I want. In output 1 I have all rows (even that in which column1 is NULL), and in output2 I have only theese rows in which column1 is NULL (that is what I want). I don't want rows with column1=NULL in output1!!

What am I doing wrong? Have you any sugestions?

regards
LUK
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
Usually I use:

Code: Select all

Len(Trim(Link.col)) = 0
As indication for empty or space only strings or nulls, when reading a sequential file they are the same.
Bare in mind there are times, like reading from DB, where they should be distincted and they don't mean the same thing.

this example is good when all stated options should be concidered as nulls.

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

roy, thanks for sugestionn , but this is not my problem! NULL detection (isnull() or Len(Trim(Link.col))=0) works fine !! But I don't want that rows with NULL detected goes to output1!! But they goes!! I don't know why!
LUK
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Luk,

did you remember that a constraint gets evaluated to TRUE and then sends the column out that stream.

Meaning that if the constraint reads "ISNULL(In.Column)" then only nulls columns are passed, and the REJECT merely takes any rows that haven't gone down any previous links.

Looking at your logic and reading your text I think you have the functionality inverted.
Luk
Participant
Posts: 133
Joined: Thu Dec 02, 2004 8:35 am
Location: Poland
Contact:

Post by Luk »

Yes, you have right Arnd! My nistake! Thanks!
LUK
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

So you really need Not(IsNull(In.Column))
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