compare of 2 values

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
Tlam
Participant
Posts: 16
Joined: Thu Aug 23, 2007 12:56 am

compare of 2 values

Post by Tlam »

Hi,

Please advice on following situation.

I have a value coming from the source which normally should look like this '20080701' or '20071105' but sometimes they delivered this '20080000'. I want to build a check in the stage variables to exclude these incorrect values. Please advice me how to check only on the last 4 digits? reject when the last 4 digits is 0000.

Thanks in advance
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Put a constraint of "RIGHT(In.DateColumn,4)<>'000'"
poornima.chandramouli
Participant
Posts: 42
Joined: Wed Dec 26, 2007 1:58 am
Location: India

Re: compare of 2 values

Post by poornima.chandramouli »

Tlam wrote:Hi,

Please advice on following situation.

I have a value coming from the source which normally should look like this '20080701' or '20071105' but sometimes they delivered this '20080000'. I want to build a check in the stage variables to exclude these incorrect values. Please advice me how to check only on the last 4 digits? reject when the last 4 digits is 0000.

Thanks in advance
The values was seems to be a date value,first u have to take the last 2 digits by using Right(column_name,2) function & chk whether it is less than 31 & then take the last 4 digits by using Left(Right(column_name,4),2) & chk whether it is less than 12.
Check for both these conditions,if both are not satisfied then reject the records by placing it in a constraint.
Regards
rajendharreddy
Participant
Posts: 46
Joined: Tue Aug 21, 2007 5:39 am
Location: Bangalore, India

Post by rajendharreddy »

Simple could be, in constraint check for Right(column_name,4)=0000, then reject the rows.
Tlam
Participant
Posts: 16
Joined: Thu Aug 23, 2007 12:56 am

Post by Tlam »

Thanks all for your help. I found it as well, i forgot how to search and suddenly realize :oops:
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you want to search for "valid date" it's a slightly different approach. Use something like

Code: Select all

Oconv(Iconv(InLink.TheDate,"DYMD"),"DYMD[4,2,2]":@VM:"MCN") <> InLink.TheDate
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