Lookup on date fields.

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
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Lookup on date fields.

Post by meena »

Hi All,
I am extracting the data from table (oracle) and creating a hash file.This hash file is used as a lookup in other job with the table(oracle). I have date fields in the hash file which are used as lookup.
The date fields of hash file and date fields of the table are in same format. But I do not know where I am doing wrong I am not able to compare them . Beside this, after running the job when I view the hash file the fields data are shifting.

Ex:

Hash file before run:

COL1,COL2,COL3
2006-09-28 00:00:00,2006-12-05 00:00:00,1

Hash file after run:

COL1,COL2,COL3
,2006-09-28 00:00:00,2006-12-05 00:00:00

This is for lookup on key COL1. If I am doing on the two(COL1,COL2) then the same with two blocks move.

I am not understanding why this is happening. I tried with the internal conversions of dates. But even I am facing the same problem.

Thanks in advance,
Meena
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Make sure you have identical metadata both, while building the hashed file and while referencing it.
Also make sure that you trim the key fields while loading the data and also during lookup, trim the source keys.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi DSguru2B,
I did use trim and also tried it with internal conversion. But I am getting same problem of fields data moved to next field(hash file after job run) only for date lookup fields.

Thanks,
Meena.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Fields 'move' in a hashed file when your metadata isn't identical across uses. Meaning, if you create the hashed file with two keys and three data fields then your lookup will need the same two keys and three data elements - and they must be declared in the same order.

Now, as with most rules, there are exceptions to this - but you really need to understand how things work under the covers before you go trying to break them. That being said, the typical reason for columns shifting is when Key fields aren't mentioned. Anything like that going on?
-craig

"You can never have too many knives" -- Logan Nine Fingers
meena
Participant
Posts: 430
Joined: Tue Sep 13, 2005 12:17 pm

Post by meena »

Hi Craig,
Actually I was trying to redesign the job. Yes as you said this is because of the key not defined. One of the column used as the look up is not defined as a key in the first job. I have changed it and now everything is running fine.

Thanks a lot.
Meena
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

As I indicated before, the metadata needs to be identical.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply