Inserting NULL records even after defining constraint

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

PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Inserting NULL records even after defining constraint

Post by PRIYARAJ »

Hi,

I am reading a data from a file which has "~" as a delimiter.I am writing to a table.There is column PHONE from source where I have check for null value.I should insert the data only when PHONE is not null.

So I defined a stage variable with condition If IsNull(LK1.PHONE) Then 'N" Else 'Y'.

The constraint I give is StageVar='Y'.Even after defining the constraint,null records are getting populated.Is there any way that I can do this?
But,where the PHONE is null in file holds the data like this :

N-0402~~N~Y~CTR

If there is a value for PHONE then the data look like :

N-7501~462323696~Y~N~CTR
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Please remember that an empty string, "", is not null.
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks for your response.

So should I have to give If LK1.PHONE="" Then 'N' Else 'Y' condition?

Thanks again
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks for your response.

So should I have to give If LK1.PHONE="" Then 'N' Else 'Y' condition?

Thanks again
WoMaWil
Participant
Posts: 482
Joined: Thu Mar 13, 2003 7:17 am
Location: Amsterdam

Post by WoMaWil »

Concerning telefonnumbers some remarks:

(1) you should check more than "Null" perhaps if at least one number is in it.

(2) There are a lot of formats which differ from region to region in the world.

(3) In some countries and among countries telephone numbers have a different length

(4) Best is to use the international standardize way for numbers like +33-1-2345-3456 for a number in Paris
Wolfgang Hürter
Amsterdam
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks a lot !

I will fix it & let you know if I have any issues.
SHARAD123
Premium Member
Premium Member
Posts: 54
Joined: Wed Jan 09, 2008 12:05 am

Post by SHARAD123 »

Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )
222102
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks .

I will try the code which you have sent & let you know .

Thanks again
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

SHARAD123 wrote:Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )

Sharad,

I tried using the constraint which You sent ,but it still inserts all the data.Its because of empty string?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

SHARAD123 wrote:Hi priyaraj,

Y don you try a much simpler solution....

There is no need to use stage variables for this functionality.
Instead check condition in the constraint for the link.

Use this constraint:
not(isnull(required link) )
You won't be getting NULLs from a text file. The constraint should be

Code: Select all

Trim(In.ColumnName)#''
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Hi ARVD,


I cannot see your eply as I am not a premium member.Thanks!
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

No problem, Priyaraj. Someone else might post a non-premium response that will help you soon.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:Please remember that an empty string, "", is not null.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Premium membership is not expensive; it's less than 30c (Rs12) per day. Revenue from premium memberships is totally devoted to helping to defray the hosting and bandwidth costs incurred by DSXchange. And you get to be able to read the entire contents of premium posters' contributions, among other benefits.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
PRIYARAJ
Participant
Posts: 41
Joined: Fri Jan 18, 2008 10:23 am

Post by PRIYARAJ »

Thanks for your information.I will buy Premium membership if its only 30c per day.Thanks again
Post Reply