Looping in Transformerstage

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
vinsashi
Participant
Posts: 150
Joined: Mon Aug 20, 2007 4:52 am
Location: singapore

Looping in Transformerstage

Post by vinsashi »

MY SOURCE DATA HAS THESE COLUMNS
UOM
PARENTMEASURE
PARENTLEVEL
CURRENT LEVEL
PARENTROLLUPOPERATOR
AMOUNT

COST PROFIT 0 1 -
DIRECTCOST COST 1 2 + 75
INCOME PROFIT 0 1 +
NETINTERESTINCOME INCOME 1 2 + 100
PROFIT PROFIT 0 0 +
INDIRECTCOST COST 1 2 + 10

I WANT
OUTPUT LIKE
PROFIT INCOME-EXPENSE=15

pLZ HELP HOW TO DO THIS ONE
HERE LOT OF DATA WIL COME LIKE THIS SO I NEED TO GROUP WITH CURRENTLEVEL AND PARENTMEASURE

THANKS IN ADAVANCE
VIN....
[/list]
    ray.wurlod
    Participant
    Posts: 54607
    Joined: Wed Oct 23, 2002 10:52 pm
    Location: Sydney, Australia
    Contact:

    Post by ray.wurlod »

    1. Don't shout. All upper case is regarded as shouting and is offensive.

    2. Can you please be clearer about your requirements. I have no idea what the numbers mean. Use code tags to preserve spacing.

    3. I doubt that any looping will be involved.
    IBM Software Services Group
    Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
    vinsashi
    Participant
    Posts: 150
    Joined: Mon Aug 20, 2007 4:52 am
    Location: singapore

    Post by vinsashi »

    Hi ray,
    My source is like this
    UOM PARENTMEASURE PARENTLEVEL CURRENT LEVEL PARENTROLLUPOPERATOR AMOUNT
    COST PROFIT 0 1 -
    DIRECTCOST COST 1 2 + 75
    INCOME PROFIT 0 1 +
    NETINTERESTINCOME INCOME 1 2 + 100
    PROFIT PROFIT 0 0 +
    INDIRECTCOST COST 1 2 + 10


    my source data is like this.here i want to implement loop.
    if we observe cost(underparent measure) is parent for directcost and indirectcost and for that operator is + .so we should add amount then that we should assign to cost(75+10=85)
    same like netintrestincome is child of income so income should 100
    finally profit is parent of cost and income(but here means in first record for cost and profit parentrollupoperator is '-(minus) and in third record for income and profit rollup operator is '+')
    so profit=income-cost
    so here for understanding i given some records but in future we wil get more records

    i need to implement looping here(lowerlevel data should add r minus to upper level depend upon operator


    Thanks in Adavance
    vin...
    chulett
    Charter Member
    Charter Member
    Posts: 43085
    Joined: Tue Nov 12, 2002 4:34 pm
    Location: Denver, CO

    Post by chulett »

    There's no "looping" inside a job, there is however "aggregation" which this seems like it might be.
    -craig

    "You can never have too many knives" -- Logan Nine Fingers
    vinsashi
    Participant
    Posts: 150
    Joined: Mon Aug 20, 2007 4:52 am
    Location: singapore

    Post by vinsashi »

    Hi chulett,
    i said that one sample data.in source data i wil get so many levels. according to that one i have to do operation.for example
    CM PM CL PL OP AMOUNT
    A A 1 1 +
    B A 2 1 + 10
    D C 4 3 - 5
    C B 3 2 + 10
    H G 5 4 + 5
    G F 4 3 + 5
    F
    vinsashi
    Participant
    Posts: 150
    Joined: Mon Aug 20, 2007 4:52 am
    Location: singapore

    Post by vinsashi »

    Hi Chulett,
    i didnt mentioned clearly in previous message.
    CM PM CL PL OP AMT
    A A 1 1 +
    B A 2 1 + 10
    D C 4 3 + 5
    E A 2 1 -
    C B 3 2 + 10
    F E 3 2 + 5
    G F 4 3 + 10
    H G 5 4 + 5


    WHERE CM=CURRENT MEASURE PM=PARENT MEASURE
    CL=CURRENT LEVEL PL=PARENT LEVEL OP=OPERATION BETWEN THEM AMT=AMOUNT

    HERE GROUP BY CL ,PM,CL AND WE HAVE TO FIND OUT OPEREND ACCORDING TO THAT WE HAVE TO PERFORM OPERATION
    AND WE SHOULD ADD CURRENT MEASURE DATA TO THAT PARENT MEASURE(SO HERE WE NEED LOOPING)
    DESIRED OUTPUT IS LIKE THIS
    OUTPUT
    CM PM CL PL OP AMT
    A A 1 1 + 5
    B A 2 1 + 25
    D C 4 3 + 5
    E A 2 1 - 20
    C B 3 2 + 15
    F E 3 2 + 20
    G F 4 3 + 15
    H G 5 4 + 5


    Thanks in adavance
    vin..
    ray.wurlod
    Participant
    Posts: 54607
    Joined: Wed Oct 23, 2002 10:52 pm
    Location: Sydney, Australia
    Contact:

    Post by ray.wurlod »

    Please use Code tags to make your layout clear. For example:

    Code: Select all

    CM  PM  CL  PL  OP  AMT 
    A   A   1   1   + 
    B   A   2   1   +   10 
    D   C   4   3   +    5 
    E   A   2   1   - 
    C   B   3   2   +   10 
    F   E   3   2   +    5 
    G   F   4   3   +   10 
    H   G   5   4   +    5 
    
    That having been done, can you please try to paraphrase your exact requirement; I must profess myself still confused.

    I suspect all you need is a conditional lookup (level > 0) to retrieve the parent measure.
    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