parsing full file for a string

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
mahi_mahi
Charter Member
Charter Member
Posts: 45
Joined: Mon Aug 01, 2005 10:02 am

parsing full file for a string

Post by mahi_mahi »

Hi All,
I have a requirement like this, I have a data file and lookup file
in datafile i have a field called file_name which is lenght of say 50

my reqmnt is to process each record from data-file and see
if any of the record from lookup file has the file_name, then that
record from data-file should be written in output example

data-file:
john
raam
Dev
rita

Lookup file
raajohnxyz
zaadasd
abcrita
asdfasd

my out-file should have below records
john
rita

coz rita john records from data-file are as substring in lookup file

One way of doing this in datastage is reading data-file as input and inside transformer I can call a routine and in that routine I can read look-up
file and return the indicator....let me know if anything better way to do
in datastage...am relatively new to this tool

Mahi
ratikmishra1
Charter Member
Charter Member
Posts: 42
Joined: Wed Aug 18, 2004 2:49 pm

Post by ratikmishra1 »

if position and length of your file_name field in your lookup file is fixed, then you can build a has file.

then use the hash file in the transformer to do the existence check.
diamondabhi
Premium Member
Premium Member
Posts: 108
Joined: Sat Feb 05, 2005 6:52 pm
Location: US

Post by diamondabhi »

Hashed file please.
Every great mistake has a halfway moment, a split second when it can be recalled and perhaps remedied.
mahi_mahi
Charter Member
Charter Member
Posts: 45
Joined: Mon Aug 01, 2005 10:02 am

Post by mahi_mahi »

Thanks a lot for the response , How can i use hash file when portion of my lookp up file field matches with data-file field.....

Mahi
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Hashed file only does a whole-key match.
The solution to this can only be a grep for each name on the input stream, given that the "lookup file" is a file. If it's a database table, then a "LIKE" lookup might be possible, but via a Hashed File stage no.
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