Date Compare

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
vskr72
Premium Member
Premium Member
Posts: 128
Joined: Wed Apr 28, 2004 9:36 pm

Date Compare

Post by vskr72 »

I have 2 inputs coming to a TX stage.

<pre>
SEQ 1---------------------------> TX1 --------------------> SEQ3
|
SEQ 2 -----> TX2-----------> HASH1

</pre>

The SEQ1 stage has over 50K records. One of the column being Date. SEQ2 has just 1 recordwhich is another date value. I want to compare 2 dates and pass all those values to SEQ3 based on the condition SEQ2.date>SEQ1.date.

When I run the job, I see a problem in SEQ2 path. It shows data being sent from SEQ2 to TX2 and to HASH1. But, I do not see any date being sent from HASH1 to TX1. Not sure what is the issue.

Also, is there any other way to implement the condition other than constraints. Any help is appreciated. Thank you.

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

Post by roy »

Hi,
Usually a lookup fails to return any data when no match was found to the lookup value.
the following reasons might cause this:
1. format differences between the value supplied to the lookup and the format of hte values in the lookup file.
2. there is actually no coresponding row in the lookup file your performing the lookup against.

By the way the lookup is explicit and exact match so even the slight change between values will result in no match.

the constraint is the place to filter unwanted or wanted records to be passed to the apropriate link.

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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Use a dummy key (something like constant 1) if you are using lookup. If the lookup is in a db, you can define the reference without any key value and hence the same record will be extracted each time.

Check the format of incoming and reference date values. Use IConv or OConv as necessary.

Alternatively use a parameter to hold the reference date and perform a constraint.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In order to compare dates for something other than equality, you must make sure they are in a format that supports that. Two choices:

1) Internal format
2) Year first numeric: YYYYMMDD

Make sure both streams use the same format and then you stand a chance of knowing if one is greater than the other. :wink:

Once that is in place, the other posters have pointed out other issues. If all you've got is a single row hash with a date field as data, you'll need to create a 'dummy' key field. Hardcode it to something and use that hardcoded value in the lookup's Key Expression to get the date to check against.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply