Page 1 of 1

how can i acheive this code in Datastage

Posted: Tue Apr 20, 2010 4:41 am
by pavankatra
How can i acheive this in Datastage?

for (i=0,n=0,i<9,i++)
{
n+=(10-i)* x.charat(i)
}


If anyone help me on this it is very helpfull for me.


Thanks in advance

Posted: Tue Apr 20, 2010 4:48 am
by Sainath.Srinivasan
What have you tried ?

What value you expect to be derived using the mentioned logic ?

Is that the full logic or something that must happen for each row ?

FYI, we can call external routine from DataStage.

To achieve your output, you can use a row generator for i and stage variable for n.

Alternatively deduce your output and stick it as text values.

Posted: Tue Apr 20, 2010 4:58 am
by pavankatra
Sainath.Srinivasan wrote:What have you tried ?

What value you expect to be derived using the mentioned logic ?

Is that the full logic or something that must happen for each row ?

FYI, we can call external routine fro ...
thank you srinivasan

actually i want to implement that for loop in the datastage
once i got the 'n' value,i will concatenate that value with 'x'.

so please help me on this

Posted: Tue Apr 20, 2010 5:18 am
by ray.wurlod

Code: Select all

9 * x.charat[1,1] + 8 * x.charat[2,1] + 7 * x.charat[3,1] + 6 * x.charat[4,1] + 5 * x.charat[5,1] + 4 * x.charat[6,1] + 3 * x.charat[7,1] + 2 * x.charat[8,1] + x.charat[9,1]
You may need to apply conversion functions like StringToDecimal() to prevent warnings.