Splitting a Sequential File

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
holymac
Participant
Posts: 25
Joined: Sun Jan 08, 2006 9:40 pm

Splitting a Sequential File

Post by holymac »

Dear All,

I have created a server job with one Source (Sequential) One transformer and one Target (DB2). The mappings are quite direct. The Target's Update Action='Update existing or insert new rows'.

I would like to do the following:

Split the Source into 2 links one for update and one for Insert and put each of them into a sequential file. How do i be able to diff between the records to be inserted and updated.

Appreciate all the assistance.

Thank you in advance.

Regards,
holymac
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

Split the Source into 2 links one for update and one for Insert and put each of them into a sequential file. How do i be able to diff between the records to be inserted and updated.
You can do this by including a target table lookup, if lookup passes it should go to the update link else the insert link.
Success consists of getting up just one more time than you fall.
kris007
Charter Member
Charter Member
Posts: 1102
Joined: Tue Jan 24, 2006 5:38 pm
Location: Riverside, RI

Post by kris007 »

Load all the key column values from the DB2 table into the Hashed file.Now look up against the rows from the hashed files with the source file keys. From the Transformer give two outputs. One for inserts and one for updates.In the Transformer give the constraint as

Code: Select all

InputLink.NOTFOUND = @TRUE(for inserts) and InputLink.NOTFOUND<>@TRUE(for updates)
and you are all set.

In BTW it is also a good design to load your updates and inserts seperately into your Database rather than using the Update action you are using currently, Unless you are dealing with very few rows i.e. some where around 100 rows. IMO.

HTH
Kris

Where's the "Any" key?-Homer Simpson
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Enrol on IBM's DataStage Essentials class, the entry level class. This is one of the techniques taught.
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