Best parcatices for business logic

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
michaeld
Premium Member
Premium Member
Posts: 88
Joined: Tue Apr 04, 2006 8:42 am
Location: Toronto, Canada

Best parcatices for business logic

Post by michaeld »

What is the best way to implement lengthy business logic in a parallel job. My specif problem is that I have an IF statement with 100 conditions each performing a different calculation. Also, the IF condition stays the same for each column, but the calculations change. Ex: In col1 IF col0=1 then col1*col0... then in col2: IF col0=1 then col2*4. I would rather not have this huge IF statement repeated for each column. What do you suggest is the best apprach for this situation. Custom routine? Custom stage? The way I did is the best way, etc...

DS 7.5x2 Parallel job.
Mike
vmcburney
Participant
Posts: 3593
Joined: Thu Jan 23, 2003 5:25 pm
Location: Australia, Melbourne
Contact:

Post by vmcburney »

I would first try to build it using a lookup table, though this depends on whether the equation fits a lookup table design. Second I would try stage variable code which works well for up to three lines of code per stage variable but is stretched beyond that. Third is probably external routine so you can code it as a black box module. I think dozens of custom routines that do one particular equation are more maintainable than a custom stage with hundreds of lines of code.
vijayrc
Participant
Posts: 197
Joined: Sun Apr 02, 2006 10:31 am
Location: NJ

Post by vijayrc »

vmcburney wrote:I would first try to build it using a lookup table, though this depends on whether the equation fits a lookup table design. Second I would try stage variable code which works well for up to three lines of code per stage variable but is stretched beyond that. Third is probably external routine so you can code it as a black box module. I think dozens of custom routines that do one particular equation are more maintainable than a custom stage with hundreds of lines of code.
Yes..a Lookup table in which all the logic can be captured would be the best bet. If this is too much in asking, part of it can be in the lookup and the rest in the Transformer logic[using stage variables] or Go for a Build-Op. Just my 2cents
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Or maybe a C function which has all different conditons in a Case statement.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
Post Reply