Constraint issue

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
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Constraint issue

Post by myukassign »

I am a .net programmer started working in Datastage. I have a question where if anyone can help me will be appriciated.

Situvation
=======

I have a source flat file with two columns ID & NAME. I am passing data to another flat file using a transformer where I have a reject link also.

Flat file data is like this

1,"Arun"
2,"John"
3,"Neri"

My constraint in the transformer is

(InputLnk.ID <> 2 and InputLnk.NAME <> "Arun")

Expected output
==========
All rows should go to the target flat file

Actual Output
========
Row 1 and Row 2 rejected


Question
======

I consider this constraint of datastage is like an if condition in c++. It will be true if both the condition in the constraint is true. In the above example, if you check there is no row where the ID=2 and Name="Arun".
But still it rejecting.

Observation
========

In the constraint if I replace "AND" with "OR". It is not rejecting any rows. I feel like datastage doing "AND" purpose using "OR" and "OR purpose using "AND".

CAn anyone clarify me whats the actul situvation here?
Jasti
Participant
Posts: 44
Joined: Sat Apr 14, 2007 6:34 am
Location: Hyderabad, India

Post by Jasti »

Observation
========

In the constraint if I replace "AND" with "OR". It is not rejecting any rows. I feel like datastage doing "AND" purpose using "OR" and "OR purpose using "AND".
This is not correct.

Please check in the source file stage whether the data is read correctly or not through ViewData..You may have missed to specify the quotes(") for the name field.
Thanks,
Mohan.A.Jasti.
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

Nope! My flat file is perfect and I used trim funcation also , incase any extra space come in.

It not because of that. Please help.
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

The result you get is correct.

You wrote:
InputLnk.ID <> 2 and InputLnk.NAME <> "Arun"
now let us look at each line
1,"Arun"
condition A:
InputLnk.ID <> 2
TRUE
condition B:
InputLnk.NAME <> "Arun"
FALSE
A AND B
FALSE => reject it
2,"John"
condition A:
InputLnk.ID <> 2
FALSE
condition B:
InputLnk.NAME <> "Arun"
TRUE
A AND B
FALSE => reject it
3,"Neri"
condition A:
InputLnk.ID <> 2
TRUE
condition B:
InputLnk.NAME <> "Arun"
TRUE
A AND B
TRUE => take it

So DataStage worked right!!!

If you want none of this rows to reject, then write:
NOT ( InputLnk.ID = 2 AND InputLnk.NAME = "Arun" )
Wolfgang Hürter
Amsterdam
myukassign
Premium Member
Premium Member
Posts: 238
Joined: Fri Jul 25, 2008 8:55 am

Post by myukassign »

Thanks.
Post Reply