Simple question : how to do "10 to the power of x"

Formally known as "Mercator Inside Integrator 6.7", DataStage TX enables high-volume, complex transactions without the need for additional coding.

Moderators: chulett, rschirm

Post Reply
michel
Participant
Posts: 4
Joined: Mon Apr 16, 2007 2:27 am

Simple question : how to do "10 to the power of x"

Post by michel »

Hello,
I wonder how to execute a basic mathematical operation :
"10 to the power x" ?

I don't know if my explanation is clear, so I will give some examples :
For example I would like to have the result of "10 to the power of 4" ( = 10000 ) ... or even "5 to th power of 3" ( = 75 ).

I did not find anything in the manual or help for this basic operator, so if you can help me, I would really appreciate.

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

Post by ArndW »

I don't know TX, but usually x**y will do it (at least that will work in server/px) - have you tried that?
michel
Participant
Posts: 4
Joined: Mon Apr 16, 2007 2:27 am

Post by michel »

Thanks a lot, but I tried it and it did not work in TX. Has anybody another idea, please ?
Thanks in advance.
janhess
Participant
Posts: 201
Joined: Thu Sep 18, 2003 2:18 am
Location: UK

Post by janhess »

At vn 8.1 you can use the POWER function in mathlib
michel
Participant
Posts: 4
Joined: Mon Apr 16, 2007 2:27 am

Post by michel »

Thanks, but the matter is that we won't upgrade to v8.1 before a long (undetermined) time. So I would really have appreciated a solution in v7.5 ... if somebody knows one !?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the exponent is integer and small you might be able to multiply in a loop.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If the exponent is integer and small you might be able to multiply in a loop.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vivek
Charter Member
Charter Member
Posts: 17
Joined: Wed Feb 22, 2006 1:38 am
Location: USA

Post by vivek »

you could use something like 10eX.
michel
Participant
Posts: 4
Joined: Mon Apr 16, 2007 2:27 am

Post by michel »

Thank you for your help, but "10eX" doesn't work and I can't do a loop (neither make a custom function) in v7.5

Is it a problem without a solution ? ... It would be a pity for such a basic operation ... :cry: ...

If someone else has an idea !? ...
DianeC
Participant
Posts: 2
Joined: Tue Jun 13, 2006 7:06 am

Post by DianeC »

Here's how I got it. Input tt has 2 fields - number, exponent
Output tt has 1 field, nbrout (1:s)
Map has 1 input card, 2 output cards (first one set to 'sink'), one Functional map.

1st output card has the nbrout field indexed to get to the 1st occurance, then the rest. nbrout [1], nbrout[2:s] The first occurance gets loaded with the number itself.
nbrout[2:s] is the FMap using an index to compare to the exponent for the looping. The FMap just multiplies the nbrout*number repeatedly until loop condition is met.
"IF ( INDEX($) < Exp Fields:NbrFle, DoFINAL(NumberTst Fields:NbrFle, NbrOut Fields:DtOut))"

The 2nd output card maps the last occurance of the multiple nbrout from the first output card for the answer. nbrout[LAST].

Doing this, I used 2 as the number and 4 as the exponent, got 16 for my output.

Of course if you're working from deeper within a map, you can change it as needed, but you get the idea.
Post Reply