modify constraint

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
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

modify constraint

Post by times29 »

Hi,
I have below constraint in transformer to_transf.COST_CNTR_SK< 0 which reject the rows i need to modify it

Right now it does as below
Doc_num line_num COST_CNTR_SK
123 1 -1 ---reject
123 2 56 -------load in table

Now we want to reject both rows if doc_num is same. how can i modify the constraint .

Thanks,
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

First you will have to sort by Doc_num and by COST_CNTR_SK.
Then create a stage variable to hold your last rejected Doc_Num
Then use another stage variable to compare your current Doc_Num with the last rejected one to decide if to reject the current row.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Stage Variables
svRejectDocNum IF svLastRejectedDocNum=In.Doc_Num OR In.Doc_Num < 0 THEN DocNum ELSE 0
svLastRejectedDocNum IF svRejectDocNum>0 THEN svRejectDocNum ELSE 0

Constraint: svRejectDocNum=0

This assumes that Doc_Num is never 0
times29
Premium Member
Premium Member
Posts: 202
Joined: Mon Sep 22, 2008 3:47 pm

Post by times29 »

In stageVariables i am doing below for StageDocNum

If (to_transf.COST_CNTR_SK<0 OR to_transf.ORDER_SK< 0 then to_transf.DOC_NUM else 0)

and then on constraint i am doing

(to_transf.COST_CNTR_SK< 0 OR to_transf.ORDER_SK< 0 and to_transf.DOC_NUM= StageDocNum)

and it is getting the result any idea what i am going wrong

Note:I need to renew my membership so please don't hide the answer for now
Post Reply