How to do some calculation in a loop ?

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 to do some calculation in a loop ?

Post by pavankatra »

Hi
How to do some calculation in a loop ?
loop is given below.. its urgent..
for ( i = 0, n = 0; i < 9; i++ )
{ n += (10 - i) * x.charAt(i) };

Quick help will be appreciated a lot

Please anyone can help me on this issue.

Thanks
Pavan Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

A) It's not urgent for us but I just happen to be up and posting at this time.

B) Why not spell out your requirements in words rather than code? Tell us what you have to do, not how you think you need to do it.
-craig

"You can never have too many knives" -- Logan Nine Fingers
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

Post by pavankatra »

chulett wrote:A) It's not urgent for us but I just happen to be up and posting at this time.

B) Why not spell out your requirements in words rather than code? Tell us what you have to do, not how you think you need to do it.
i want to implement that for loop in the datastage,so can anyone please suggest me how to implement that for loop in Datastage Transformer.

for ( i = 0, n = 0; i < 9; i++ )

{ n += (10 - i) * x.charAt(i) };

Here i want to calculate the sum of n once that loop is over.
Thanks
Pavan Kumar
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Again... in words? Like you were writing a requirement for someone else to follow? Worst case, write your own C++ routine and call that.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can you let the forum members know why you want that to be solved.

An exact replica was posted few days ago.

Any interview slots to fill ?
pavankatra
Participant
Posts: 86
Joined: Wed Mar 03, 2010 3:09 am

Post by pavankatra »

Sainath.Srinivasan wrote:Can you let the forum members know why you want that to be solved.

An exact replica was posted few days ago.

Any interview slots to fill ? ...
THanks for your reply.

I have created stage variables to resolve this issue.

Anyway thanks everyone.

Thanks\
Pavan Kumar
Post Reply