Maximum() Function

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
c341
Participant
Posts: 39
Joined: Mon Jan 26, 2004 8:43 pm

Maximum() Function

Post by c341 »

Hi
I like to get the maximum value from the values passed. for example Id 1 to 100, I like to get 100 in the derivation in the transformer...In the transformer the maximum() is not allowed...Is there any other functions I can used..
Thank You
Regards - c341
xcb
Premium Member
Premium Member
Posts: 66
Joined: Wed Mar 05, 2003 6:03 pm
Location: Brisbane, Australia
Contact:

Post by xcb »

The maximum function is still allowed in a transformer or stage variable derivation even though it comes up red. The function isn't in the reserved word list (or something similar).

Try compiling the job, it should still work.
Cameron Boog
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You could setup a Stage Variable to track this, I would think. A simple check for the current value being greater than the saved value? :? Really depends on what you are trying to accomplish and when you need the max value.
-craig

"You can never have too many knives" -- Logan Nine Fingers
rasi
Participant
Posts: 464
Joined: Fri Oct 25, 2002 1:33 am
Location: Australia, Sydney

Post by rasi »

You can do what Craig mentioned of using a stage variable and check each time whether the new value greater than the stored value and if it is then store the currect value to the stage variable.

Alternatively you can use the Aggregator stage in datastage to do this. Also if you source is table then use the max database function. It's really depend on what you want to do and how many records you have. Cos Aggregator stage can be slow if you have more records.

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

Post by ray.wurlod »

The Maximum() function that Cameron referred to is to find the largest element in a dynamic array. It is not suited to the requested purpose of finding the maximum value in a column over N rows.

I'd prefer to grab it from source if that were possible, using MAX(colname) in SQL.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Hi

I am not sure about your correct requirement. For finding maximum value use Aggregator stage or use database query itself you find.

Ex;

SELECT MAX(Column_name) from Table name


Try this...
Post Reply