First Instance Comparison 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
kashif007
Premium Member
Premium Member
Posts: 216
Joined: Wed Jun 07, 2006 5:48 pm
Location: teaneck

First Instance Comparison Logic

Post by kashif007 »

How do I compare the data in the same table, the expected result is shown at the end:

Data from Legacy:
mtl bin qty sum plnt1 qty1 plnt2 qty2
1 A 4 4 2200 5 1200 8
1 B 2 6 2200 5 1200 8 split into two
1 C 2 8 2200 5 1200 8
1 D 5 13 2200 5 1200 8

I have stage variables to contain qty and qty1 sequentially.
The first instance where qty1 is less than sum split the qty into two. For example in record 2 when sum(6) is less than qty1(5) then split qty(2) into two records. In short, If qty is greater than remaining qty1 then split qty.

Finally records should look like the following
mtl bin qty plnt
1 A 4 2200
1 B 1 2200
1 B 1 1200
1 C 2 1200
1 C 5 1200

Please suggest.
Regards
Kashif Khan
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Two outputs from Transformer with constraints qty1=qty1 (or simply unconstrained) and the other qty1<>qty2. Bring them back together with a Funnel stage if needed.
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