Date Range Validation

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
nani0907
Participant
Posts: 155
Joined: Wed Apr 18, 2007 10:30 am

Date Range Validation

Post by nani0907 »

hi,

I need to check wthether the Effective date is in between the Start date and end date cloumn. here is the example.

Eff date Start Date End date
20091231 20081231 20111231

20071231 20081231 20111231

For the above records, i need to pick up the first record as Eff date is beetween the start date and End date. my source is file . how check the range ttrougt the transformer stage.

Thanks in Advance
thanks n regards
nani
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Since your date format is YYYYMMDD you can use straightforward string/numeric checks for values greater than a less than, i.e.

Code: Select all

IF In.EffDate > In.StartDate AND In.EffDate < In.EndDate THEN 'Good' ELSE 'Bad'
Last edited by ArndW on Thu Apr 01, 2010 7:34 am, edited 1 time in total.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

When you generate test data, you need to construct expected results which you compare with actual results.

Can you please describe the expected results for your two examples?

I suspect Arnd's partial solution will get you most of the way there, but that you require not "Good"/"Bad" as the output but, rather, the beginning date of the period. This is no big deal to change the expression, but I need to be confident that you have fully specified the requirement.

Otherwise all that typing has been a waste of time.
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