how can i acheive this code in Datastage

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
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

how can i acheive this code in Datastage

Post 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
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post 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.
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

Post 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
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post 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.
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