Need help to resolve a 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
ray.wurlod
Participant
Posts: 54595
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I cannot discern any generalizable logic that would produce the desired output. Can you please provide a written rule (or set of rules)? In particular I don't understand how the final two rows in your example, especially the penultimate one, are obtained.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

So the logic is:
(a) If the first column is NULL, then use the value from the previous row's first column instead of the NULL.
(b) If the second column is NULL; then use the value from the current row's first column instead of the NULL.

If that is correct, then use 2 stage variables as follows:

Code: Select all

svNewColumnValue       IF IsNull(In.NewColumn) THEN svLastNewColumnValue ELSE In.NewColumn
svLastNewColumnValue     In.NewColumn
svOldColumnValue      IF IsNull(In.OldColumn THEN svNewColumnValue ELSE In.OldColumn
Derive NewColumn from svNewColumnValue and OldColumn from svOldColumnValue.
Post Reply